A2osX/BIN/CC.S.txt
burniouf 947764b71e SH:History fix
MORE:combined options
CC:"All done" message if success
2022-10-08 14:37:10 +02:00

1129 lines
23 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/cc
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
*--------------------------------------
FILES.MAX .EQ 4
LIBS.MAX .EQ 4
SCOPE.MAX .EQ 16
LOOKUP.MAX .EQ 16
*--------------------------------------
SYM.T .EQ 0
SYM.T.VOID .EQ 1
SYM.T.UCHAR .EQ 2
SYM.T.SCHAR .EQ 3
SYM.T.UINT .EQ 4
SYM.T.SINT .EQ 5
SYM.T.ULONG .EQ 6
SYM.T.SLONG .EQ 7
SYM.T.FLOAT .EQ 8
SYM.T.SU .EQ 9
SYM.T.ENUM .EQ 10
SYM.T.VARIADIC .EQ $FF
SYM.Q .EQ 1
SYM.Q.POINTER .EQ %01000000
SYM.Q.PPOINTER .EQ %10000000
SYM.Q.PPPOINTER .EQ %11000000
SYM.Q.ARRAY .EQ %00010000
SYM.Q.AARRAY .EQ %00100000
SYM.Q.AAARRAY .EQ %00110000
SYM.Q.CONST .EQ %00001000
SYM.Q.VOLATILE .EQ %00000100
SYM.Q.FUNC .EQ %00000010
SYM.Q.FASTCALL .EQ %00000001
SYM.SC .EQ 2
SYM.SC.STATIC .EQ 0
SYM.SC.AUTO .EQ 2
SYM.SC.REGISTER .EQ 4
SYM.SC.EXTERN .EQ 6
SYM.SC.TYPEDEF .EQ 8
SYM.SC.DEFINE .EQ 10
SYM.SC.TAG .EQ 12
SYM.hSym .EQ 3
SYM.SizeOf .EQ 4
SYM.Addr .EQ 6
SYM.BitO .EQ 8
SYM.BitW .EQ 9
SYM.DefSize .EQ 10
SYM.Def .EQ 11 Funtions : fTQ,a1TQ,a2TQ....
*
SYM .EQ 14
*--------------------------------------
SU.F.T .EQ 0
SU.F.Q .EQ 1
SU.F.O .EQ 2
SU.F.BitO .EQ 4
SU.F.BitW .EQ 5
SU.F.Name .EQ 6
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPPtr3 .BS 2
ArgIndex .BS 1
bPass2 .BS 1
ZPCCCode .BS 2
ZPCCConst .BS 2
ZPCCData .BS 2
ZPCCStack .BS 2
ZPLineBufPtr .BS 2
ZPLookupPtr .BS 2
CStackPtr .BS 1
LocalPtr .BS 1
ScopeIdx .BS 1
bLocalScope .BS 1
ZPSymBufPtr .BS 2
ZPLookupSymPtr .BS 2
bInitCode .BS 1
StmtPreOp .BS 1
ExpState .BS 1
*ExpState.VinYA .EQ $10
ExpState.AonStack .EQ $20
ExpState.AinPTR .EQ $40
ExpState.VonStack .EQ $80
ZPState .BS 1
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 Size
.DA #256 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
*--------------------------------------
L.MSG.GREETINGS .DA MSG.GREETINGS
L.MSG.USAGE .DA MSG.USAGE
L.MSG.READING .DA MSG.READING
L.MSG.LINKING .DA MSG.LINKING
L.MSG.LINKING2 .DA MSG.LINKING2
L.MSG.GENERATING .DA MSG.GENERATING
L.MSG.DEBUG .DA MSG.DEBUG
L.MSG.TRACE .DA MSG.TRACE
L.MSG.RTSTK .DA MSG.RTSTK
L.MSG.ERROR .DA MSG.ERROR
L.MSG.SUMMARY .DA MSG.SUMMARY
L.MSG.NOMAIN .DA MSG.NOMAIN
L.MSG.ALLDONE .DA MSG.ALLDONE
L.ENV.INCLUDE .DA ENV.INCLUDE
L.ENV.LIB .DA ENV.LIB
L.LIB.O .DA LIB.O
*--------------------------------------
L.CC.AOPS .DA CC.AOPS
L.CC.PREOPS .DA CC.PREOPS
L.CC.POSTOPS .DA CC.POSTOPS
L.CC.BOPS .DA CC.BOPS
L.CC.DIRS .DA CC.DIRS
L.CC.KW .DA CC.KW
L.CC.KW2.IF .DA CC.KW2.IF
L.CC.KW2.DO .DA CC.KW2.DO
L.CC.SCSPEC .DA CC.SCSPEC
L.CC.TYPEQUAL .DA CC.TYPEQUAL
L.CC.TYPESPEC .DA CC.TYPESPEC
L.CC.TYPES .DA CC.TYPES
L.CC.FTYPES .DA CC.FTYPES
*--------------------------------------
J.CC.DIRS .DA DIR.DEFINE
.DA DIR.INCLUDE
.DA DIR.IFDEF
.DA DIR.IFNDEF
*--------------------------------------
J.CC.PREOPS .DA EXP.Ref
.DA EXP.Deref
.DA EXP.Abs
.DA EXP.negate
.DA EXP.lnot
.DA EXP.bnot
.DA EXP.preinc
.DA EXP.predec
*--------------------------------------
J.CC.POSTOPS .DA EXP.postinc
.DA EXP.postdec
.DA EXP.idx
.DA EXP.SU
.DA EXP.pSU
*--------------------------------------
J.CC.KW .DA KW.IF
.DA KW.WHILE
.DA KW.ELSE
.DA KW.DO
.DA KW.FOR
.DA KW.SWITCH
.DA KW.CASE
.DA KW.DEFAULT
.DA KW.BREAK
.DA KW.CONTINUE
.DA KW.RETURN
.DA KW.SIZEOF
*--------------------------------------
J.CC.KW.END .DA KW.IF.END
.DA KW.WHILE.END
.DA KW.ELSE.END
.DA KW.DO.END
.DA KW.FOR.END
.DA KW.SWITCH.END
*--------------------------------------
J.CC.SCSPEC .DA DECL.AUTO
.DA DECL.REGISTER
.DA DECL.STATIC
.DA DECL.EXTERN
.DA DECL.TYPEDEF
J.CC.TYPEQUAL .DA TYPE.CONST
.DA TYPE.VOLATILE
J.CC.TYPESPEC .DA TYPE.STRUCT
.DA TYPE.UNION
.DA TYPE.ENUM
.DA TYPE.SIGNED
.DA TYPE.UNSIGNED
.DA TYPE.SHORT
J.CC.TYPES .DA TYPE.VOID
.DA TYPE.CHAR
.DA TYPE.INT
.DA TYPE.LONG
.DA TYPE.FLOAT
J.CC.UTYPES .DA TYPE.UCHAR
.DA TYPE.UINT
.DA TYPE.ULONG
J.CC.STYPES .DA TYPE.SCHAR
.DA TYPE.SINT
.DA TYPE.SLONG
*--------------------------------------
L.CC.MAIN .DA CC.MAIN
L.CC.SYSCALL .DA CC.SYSCALL
L.CC.FPUCALL .DA CC.FPUCALL
*--------------------------------------
L.PCC.FH .DA PCC.FH
L.PCC.DEBUG .DA PCC.DEBUG
L.PCC.SLEEP .DA PCC.SLEEP
L.PCC.ENTER .DA PCC.ENTER
L.PCC.LEAVE .DA PCC.LEAVE
L.PCC.ADDLOCAL .DA PCC.ADDLOCAL
L.PCC.SetRetValue .DA PCC.SetRetValue
L.PCC.TestZero1 .DA PCC.TestZero1
L.PCC.TestZero2 .DA PCC.TestZero2
L.PCC.TestZeroX .DA PCC.TestZeroX
L.PCC.TestnZero1 .DA PCC.TestnZero1
L.PCC.TestnZero2 .DA PCC.TestnZero2
L.PCC.TestnZeroX .DA PCC.TestnZeroX
L.PCC.PushLAddrH .DA PCC.PushLAddrH
L.PCC.PushLAddrL .DA PCC.PushLAddrL
L.PCC.PushIAddr .DA PCC.PushIAddr
L.PCC.PushUAddr .DA PCC.PushUAddr
L.PCC.GetLAddr1 .DA PCC.GetLAddr1
L.PCC.GetIAddr1 .DA PCC.GetIAddr1
L.PCC.GetUAddr1 .DA PCC.GetUAddr1
L.PCC.PopAddr1 .DA PCC.PopAddr1
L.PCC.PopValue1 .DA PCC.PopValue1
L.PCC.PopValue2 .DA PCC.PopValue2
L.PCC.PopValueX .DA PCC.PopValueX
L.PCC.GetLAddr2 .DA PCC.GetLAddr2
L.PCC.GetIAddr2 .DA PCC.GetIAddr2
L.PCC.GetUAddr2 .DA PCC.GetUAddr2
L.PCC.PopAddr2 .DA PCC.PopAddr2
L.PCC.Deref2 .DA PCC.Deref2
L.PCC.PushDeref2 .DA PCC.PushDeref2
L.PCC.PushValue1 .DA PCC.PushValue1
L.PCC.PushValue2 .DA PCC.PushValue2
L.PCC.PushValueY .DA PCC.PushValueY
L.PCC.Inc1 .DA PCC.Inc1
L.PCC.Inc2 .DA PCC.Inc2
L.PCC.Inc4 .DA PCC.Inc4
L.PCC.Dec1 .DA PCC.Dec1
L.PCC.Dec2 .DA PCC.Dec2
L.PCC.Dec4 .DA PCC.Dec4
*--------------------------------------
L.PCC.bBOPS .DA PCC.BOPS.bMUL
.DA PCC.BOPS.bDIV
.DA PCC.BOPS.bMOD
.DA PCC.BOPS.ADD
.DA PCC.BOPS.SUB
.DA PCC.BOPS.SHL
.DA PCC.BOPS.SHR
.DA PCC.BOPS.L
.DA PCC.BOPS.G
.DA PCC.BOPS.LE
.DA PCC.BOPS.GE
.DA PCC.BOPS.EQ
.DA PCC.BOPS.NE
.DA PCC.BOPS.LAND
.DA PCC.BOPS.AND
.DA PCC.BOPS.LOR
.DA PCC.BOPS.OR
.DA PCC.BOPS.EOR
*--------------------------------------
L.PCC.cBOPS .DA PCC.BOPS.cMUL
.DA PCC.BOPS.cDIV
.DA PCC.BOPS.cMOD
.DA PCC.BOPS.ADD
.DA PCC.BOPS.SUB
.DA PCC.BOPS.SHL
.DA PCC.BOPS.SHR
.DA PCC.BOPS.L
.DA PCC.BOPS.G
.DA PCC.BOPS.LE
.DA PCC.BOPS.GE
.DA PCC.BOPS.EQ
.DA PCC.BOPS.NE
.DA PCC.BOPS.LAND
.DA PCC.BOPS.AND
.DA PCC.BOPS.LOR
.DA PCC.BOPS.OR
.DA PCC.BOPS.EOR
*--------------------------------------
.DA 0
*--------------------------------------
* Called once at process creation
* Put code for loading LIB here
*--------------------------------------
CS.INIT clc
CS.INIT.RTS rts
*--------------------------------------
* Called until exit with CS
* if RUN exits with CC, RN entered again
*--------------------------------------
CS.RUN >PUSHW L.MSG.GREETINGS
>PUSHW A2osX.KVER
>PUSHBI 2
>SYSCALL PrintF
bcs CS.INIT.RTS
lda #hFilePtr
>STA.G hFilePtr
lda #LineCntPtr
>STA.G LineCntPtr
>LDYAI 256
>SYSCALL GetMem
bcs CS.INIT.RTS
>STYA.G LineBufPtr
txa
>STA.G hLineBuf
jsr CS.RUN.ARGS
bcs CS.INIT.RTS
jsr CORE.Init
bcs CS.INIT.RTS
jsr CODE.Init
bcs CS.INIT.RTS
jsr FIO.FOpen1st
bcs CS.INIT.RTS
*--------------------------------------
CS.RUN.CLOOP jsr CORE.CompileFile
cmp #MLI.E.EOF
bne .9
jsr FIO.FClose
bne CS.RUN.CLOOP
*--------------------------------------
jsr PrintSummary
bcs .99
jsr CC.Link
bcs .99
* >DEBUG
jsr CC.Link.CheckMain
bcs .99
dec bPass2
jsr FIO.FCreate
bcs .99
jsr CODE.Init
bcs .99
jsr FIO.FOpen1st
bcs .99
*--------------------------------------
.2 jsr CORE.CompileFile
cmp #MLI.E.EOF
bne .9
jsr CODE.EmitTail
bcs .9
jsr FIO.FClose
bne .2
*--------------------------------------
>LDYA L.MSG.ALLDONE
>SYSCALL PutS
lda #0 Exit Code = Success
sec
rts
.9 pha
jsr PrintErrorMsg
pla
sec
.99 rts
*--------------------------------------
CS.RUN.ARGS inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .8
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
ldy #1
lda (ZPPtr1),y
beq .90
ldx #OptionVars-OptionList-1
.1 cmp OptionList,x
beq .2
dex
bpl .1
bra .90
.2 cpx #4
bcc .3
inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .90
jsr FIO.LoadLIB.o
bcc CS.RUN.ARGS
rts
.3 ldy OptionVars,x
lda #$ff
sta (pData),y
bra CS.RUN.ARGS
.4 >LDA.G CC.InFileArg
bne .5
lda ArgIndex
>STA.G CC.InFileArg
bra CS.RUN.ARGS
.5 >LDA.G CC.OutFileArg
bne .90
lda ArgIndex
>STA.G CC.OutFileArg
bra CS.RUN.ARGS
.8 >LDA.G CC.InFileArg
beq .90
>LDA.G CC.OutFileArg
beq .90
clc
.9 rts
.90 >PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
lda #E.SYN
sec
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT jsr CODE.Quit
jsr CORE.Quit
.1 >LDA.G LibCount
beq .6
dec
sta (pData),y
clc
adc #hLibOs
tay
lda (pData),y
>SYSCALL FreeMem
bra .1
.6 >LDA.G hLineBuf
beq .8
>SYSCALL FreeMem
.8 clc
rts
*--------------------------------------
PrintTraceMsg
ldy #S.PS.hStdOut
* ldy #S.PS.hStdErr
lda (pPS),y
>PUSHA
>PUSHW L.MSG.TRACE
>LDA.G LineCntPtr
inc
tay
lda (pData),y
>PUSHA
dey
lda (pData),y
>PUSHA
>PUSHW.G LineBufPtr
>PUSHBI 4
>SYSCALL FPrintF
rts
*--------------------------------------
PrintDebugMsg >PUSHW L.MSG.DEBUG
>PUSHW ZPCCCode
>PUSHW ZPCCConst
>PUSHW ZPCCData
lda pStack
clc
adc #8
pha
lda pStack+1
adc #0
>PUSHA
pla
>PUSHA
>PUSHB LocalPtr
>PUSHW ZPCCStack
>PUSHB CStackPtr
tay
beq .1
lda (ZPCCStack),y
pha
iny
lda (ZPCCStack),y
ply
.1 >PUSHYA
lda ScopeIdx
sec
sbc #CC.hScopes
>PUSHA
>PUSHBI 15
>SYSCALL PrintF
>DEBUG
rts
*--------------------------------------
PrintErrorMsg >LDA.G CC.hDefineBuf
beq .10
>LDYA.G CC.SaveDefine
>STYA ZPLineBufPtr
.10 >LDA.G bTrace
bmi .1
jsr PrintTraceMsg
.1 lda ZPLineBufPtr
sec
>SBC.G LineBufPtr
tax
>LDYA.G LineBufPtr
>STYA ZPLineBufPtr
txa
beq .3
ldy #0
lda #'-'
.2 sta (ZPLineBufPtr),y
iny
dex
bne .2
txa
.3 sta (ZPLineBufPtr),y
.8 ldy #S.PS.hStdErr
lda (pPS),y
>PUSHA
>PUSHW L.MSG.ERROR
>PUSHW ZPLineBufPtr
>PUSHBI 2
>SYSCALL FPrintF
rts
*--------------------------------------
PrintSummary >PUSHW L.MSG.SUMMARY
lda ZPCCCode+1
sec
sbc #$20
>PUSHA
>PUSHB ZPCCCode
>PUSHW ZPCCConst
>PUSHW ZPCCData
>PUSHBI 6
>SYSCALL PrintF
* >DEBUG
rts
*--------------------------------------
.INB usr/src/bin/cc.s.code
.INB usr/src/bin/cc.s.core
.INB usr/src/bin/cc.s.dir
.INB usr/src/bin/cc.s.decl
.INB usr/src/bin/cc.s.stmt
.INB usr/src/bin/cc.s.kw
.INB usr/src/bin/cc.s.type
.INB usr/src/bin/cc.s.f
.INB usr/src/bin/cc.s.exp
.INB usr/src/bin/cc.s.sym
.INB usr/src/bin/cc.s.link
.INB usr/src/bin/cc.s.fio
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA
*--------------------------------------
MSG.GREETINGS .CZ "\r\nA2osX C Compiler %d.%d\r\n\r\n"
MSG.USAGE .CS "Usage : CC <option> srcfile.c dstfile\r\n"
.CS " -D : Debug Mode\r\n"
.CS " -T : Trace On\r\n"
.CZ " -L Libname1 -L Libname2 ...\r\n"
MSG.READING .CZ "*** Reading file: %s\r\n"
MSG.LINKING .CZ "*** Linking..."
MSG.LINKING2 .CZ "*** %H:%18s T/Q=%h/%h, SC=%h, Def=%h, SizeOf=%H, @=%H\r\n"
MSG.GENERATING .CZ "*** Generating: %s\r\n"
MSG.DEBUG .CS "*** pCode=%H, pConst=%H, pData=%H, pStack=%H\r\n"
.CZ " LSP=%h, CSP=%H:%h>%h:%h, ScopeIdx=%h\r\n"
MSG.TRACE .CZ "%5D> %s\r\n"
MSG.RTSTK .CZ "<pBase=%H, pVar=%H, (pVar)=%H, pStack=%H>\r\n"
MSG.ERROR .CZ " %s^\r\n"
MSG.SUMMARY .CZ "*** Compilation OK : Code size=%5D, Const size=%5D, Data size=%5D\r\n"
MSG.NOMAIN .CZ "*** No 'main()' function defined."
MSG.ALLDONE .CZ "*** All Done."
*--------------------------------------
OptionList .AS "DdTtLl"
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
*--------------------------------------
ENV.INCLUDE .AZ "INCLUDE"
ENV.LIB .AZ "LIB"
LIB.O .AZ ".o"
*--------------------------------------
CC.EscChars .AS "abefnrtv"
.HS 5C27223F
CC.EscChars.Cnt .EQ *-CC.EscChars
CC.EscCodes .HS 07081B0C0A0D090B
.HS 5C27223F
*--------------------------------------
CC.OPChars .AS "!~+-*/%=&|^<>["
CC.OPChars.Cnt .EQ *-CC.OPChars
*--------------------------------------
* Assignment Operators: = += -= *= /= %= <<= >>= &= ^= |=
*--------------------------------------
CC.AOPS .PS "="
.PS "+="
.PS "-="
.PS "*="
.PS "/="
.PS "%="
.PS "<<="
.PS ">>="
.PS "&="
.PS "^="
.PS "!="
.HS 00
*--------------------------------------
* Pre Operators: & * + - ! ~ ++ --
*--------------------------------------
CC.PREOPS .PS "&" ref
.PS "*" deref
.PS "+" abs
.PS "-" negate
.PS "!" logical not
.PS "~" bitwise not
.PS "++" pre increase
.PS "--" pre decrease
.HS 00
*--------------------------------------
* Post Operators: ++ --
*--------------------------------------
CC.POSTOPS .PS "++"
.PS "--"
.PS "["
.PS "."
.PS "->"
.HS 00
*-- Binary ---- H to L precedence -----
* Arithmetic Operators: * / %
* Arithmetic Operators: + -
* Shift Operators: << >>
* Relational Operators: < > >= < >= == !=
* Bitwise Operators: & | ^ ~
* Logical Operators: && ||
*--------------------------------------
CC.BOPS .PS "*"
.PS "/"
.PS "%"
.PS "+"
.PS "-"
.PS "<<"
.PS ">>"
.PS "<"
.PS "<="
.PS ">"
.PS ">="
.PS "=="
.PS "!="
.PS "&"
.PS "|"
.PS "^"
.PS "&&"
.PS "||"
.HS 00
*--------------------------------------
* Reserved Directives:
*--------------------------------------
CC.DIRS .PS "define"
.PS "include"
.HS 00
*--------------------------------------
* Reserved Keywords:
*--------------------------------------
CC.KW .PS "if"
.PS "while"
.PS "else"
.PS "do"
.PS "for"
.PS "switch"
.PS "case"
.PS "default"
.PS "break"
.PS "continue"
.PS "return"
.PS "sizeof"
.HS 00
CC.KW2.IF .PS "else"
.HS 00
CC.KW2.DO .PS "while"
.HS 00
*--------------------------------------
CC.SCSPEC .PS "auto"
.PS "register"
.PS "static"
.PS "extern"
.PS "typedef"
.HS 00
*--------------------------------------
CC.TYPEQUAL .PS "const" ALL
.PS "volatile"
CC.TYPESPEC .PS "struct"
.PS "union"
.PS "enum"
.PS "signed" char,int,long
.PS "unsigned" char,int,long
.PS "short" int
CC.TYPES .PS "void"
.PS "char"
.PS "int"
.PS "long"
.PS "float"
.HS 00
*--------------------------------------
CC.Type2FPU .DA #FPU.wMUL,#FPU.iMUL,#FPU.uMUL,#FPU.lMUL,#FPU.fMUL
*--------------------------------------
CC.FTYPES .PS "fastcall"
* .HS 00
*--------------------------------------
CC.TYPESIZE .HS 0001010202040405
CC.TYPESIGN .HS 0000FF00FF00FFFF
*--------------------------------------
CC.MAIN .AZ "main"
CC.MAIN.DEF .DA #SYM.T.SINT,#0,#SYM.T.SINT,#0,#SYM.T.UCHAR,#SYM.Q.PPOINTER,0
CC.MAIN.DEF.LEN .EQ *-CC.MAIN.DEF
*--------------------------------------
CC.SYSCALL .PS "chtyp"
.DA #SYS.ChTyp
.PS "chmod"
.DA #SYS.ChMod
.PS "fstat"
.DA #SYS.FStat
.PS "stat"
.DA #SYS.Stat
.PS "mkdir"
.DA #SYS.MKDir
.PS "mknod"
.DA #SYS.MKNod
.PS "mkfifo"
.DA #SYS.MKFIFO
.PS "pipe"
.DA #SYS.Pipe
.PS "opendir"
.DA #SYS.OpenDir
.PS "readdir"
.DA #SYS.ReadDir
.PS "closedir"
.DA #SYS.CloseDir
.PS "open"
.DA #SYS.Open
.PS "close"
.DA #SYS.Close
.PS "read"
.DA #SYS.Read
.PS "write"
.DA #SYS.Write
.PS "chown"
.DA #SYS.ChOwn
.PS "fputc"
.DA #SYS.FPutC
.PS "putchar"
.DA #SYS.PutChar
.PS "getc"
.DA #SYS.GetC
.PS "getchar"
.DA #SYS.GetChar
.PS "fputs"
.DA #SYS.FPutS
.PS "puts"
.DA #SYS.PutS
.PS "fgets"
.DA #SYS.FGetS
.PS "ungetc"
.DA #SYS.UngetC
.PS "fopen"
.DA #SYS.FOpen
.PS "fclose"
.DA #SYS.FClose
.PS "fread"
.DA #SYS.FRead
.PS "fwrite"
.DA #SYS.FWrite
.PS "fflush"
.DA #SYS.FFlush
.PS "fseek"
.DA #SYS.FSeek
.PS "ftell"
.DA #SYS.FTell
.PS "feof"
.DA #SYS.FEOF
.PS "remove"
.DA #SYS.Remove
.PS "rename"
.DA #SYS.Rename
.PS "printf"
.DA #SYS.PrintF
.PS "fprintf"
.DA #SYS.FPrintF
.PS "sprintf"
.DA #SYS.SPrintF
.PS "scanf"
.DA #SYS.ScanF
.PS "fscanf"
.DA #SYS.FScanF
.PS "sscanf"
.DA #SYS.SScanF
* .PS "$50"
* .DA #0
* .PS "$52"
* .DA #0
* .PS "$54"
* .DA #0
* .PS "$56"
* .DA #0
* .PS "$58"
* .DA #0
* .PS "$5A"
* .DA #0
* .PS "$5C"
* .DA #0
.PS "setattr"
.DA #SYS.SetAttr
* .PS "mount"
* .DA #0
* .PS "umount"
* .DA #0
* .PS "loadstkobj"
* .DA #0
* .PS "getstkobj"
* .DA #0
* .PS "shift"
* .DA #0
* .PS "argv"
* .DA #0
* .PS "argvDup"
* .DA #0
* .PS "geterrmsg"
* .DA #0
.PS "atof"
.DA #SYS.AToF
.PS "atoi"
.DA #SYS.AToI
.PS "atol"
.DA #SYS.AToL
.PS "strtof"
.DA #SYS.StrToF
.PS "strtol"
.DA #SYS.StrToL
.PS "strtoul"
.DA #SYS.StrToUL
.PS "realpath"
.DA #SYS.RealPath
.PS "expand"
.DA #SYS.Expand
.PS "strlen"
.DA #SYS.StrLen
.PS "strcpy"
.DA #SYS.StrCpy
.PS "strcat"
.DA #SYS.StrCat
.PS "strdup"
.DA #SYS.StrDup
.PS "strupr"
.DA #SYS.StrUpr
.PS "strlwr"
.DA #SYS.StrLwr
.PS "strcmp"
.DA #SYS.StrCmp
.PS "strcasecmp"
.DA #SYS.StrCaseCmp
* .PS "getdevbyname"
* .DA #0
* .PS "getdevstatus"
* .DA #0
* .PS "mkdev"
* .DA #0
* .PS "ioctl"
* .DA #0
* .PS "loadlib"
* .DA #0
* .PS "unloadlib"
* .DA #0
* .PS "loaddrv"
* .DA #0
* .PS "insdrv"
* .DA #0
.PS "execl"
.DA #SYS.ExecL
* .PS "execv"
* .DA #0
.PS "fork"
.DA #SYS.Fork
.PS "kill"
.DA #SYS.Kill
* .PS "loadfile"
* .DA #0
* .PS "loadtxtfile"
* .DA #0
* .PS "filesearch"
* .DA #0
* .PS "getmemstat"
* .DA #0
* .PS "strvnew"
* .DA #0
* .PS "strvset"
* .DA #0
* .PS "strvget"
* .DA #0
* .PS "strvfree"
* .DA #0
.PS "putenv"
.DA #SYS.PutEnv
.PS "setenv"
.DA #SYS.SetEnv
.PS "getenv"
.DA #SYS.GetEnv
.PS "unsetenv"
.DA #SYS.UnsetEnv
.PS "time"
.DA #SYS.Time
.PS "strftime"
.DA #SYS.StrFTime
* .PS "ptime2time"
* .DA #0
.PS "ctime2time"
.DA #SYS.CTime2Time
.PS "md5"
.DA #SYS.MD5
.PS "md5init"
.DA #SYS.MD5Init
.PS "md5update"
.DA #SYS.MD5Update
.PS "md5finalize"
.DA #SYS.MD5Finalize
.PS "getpwuid"
.DA #SYS.GetPWUID
.PS "getpwname"
.DA #SYS.GetPWName
.PS "putpw"
.DA #SYS.PutPW
.PS "getgrpgid"
.DA #SYS.GetGRGID
.PS "getgrpname"
.DA #SYS.GetGRName
.PS "putgr"
.DA #SYS.PutGR
* .PS "opensession"
* .DA #0
* .PS "closesession"
* .DA #0
* .PS "slistgetdata"
* .DA #0
* .PS "slistadddata"
* .DA #0
* .PS "slistsetdata"
* .DA #0
* .PS "slistgetbyid"
* .DA #0
* .PS "slistnewkey"
* .DA #0
* .PS "slistlookup"
* .DA #0
* .PS "slistfree"
* .DA #0
* .PS "slistnew"
* .DA #0
.PS "malloc"
.DA #SYS.GetMem
.PS "realloc"
.DA #SYS.Realloc
* .PS "getmemptr"
* .DA #0
* .PS "freemem"
* .DA #SYS.FreeMem
.PS "free"
.DA #SYS.Free
* .PS "newstkobj"
* .DA #0
* .PS "getstkobjptr"
* .DA #0
* .PS "freestkobj"
* .DA #0
.DA #0
*--------------------------------------
CC.FPUCALL .PS "pwr"
.DA #FPU.PWR
.PS "log"
.DA #FPU.LOG
.PS "sqr"
.DA #FPU.SQR
.PS "exp"
.DA #FPU.EXP
.PS "cos"
.DA #FPU.COS
.PS "sin"
.DA #FPU.SIN
.PS "tan"
.DA #FPU.TAN
.PS "atan"
.DA #FPU.ATAN
.PS "lrintf"
.DA #FPU.QINT
.DA #0
*--------------------------------------
.INB usr/src/bin/cc.s.pcc
*--------------------------------------
.DUMMY
.OR 0
DS.START
PathBuf .BS MLI.MAXPATH+1
bDebug .BS 1
bTrace .BS 1
LibCount .BS 1
hLibNs .BS LIBS.MAX
hLibOs .BS LIBS.MAX
CC.InFileArg .BS 1
CC.OutFileArg .BS 1
CC.hOutFile .BS 1
hFilePtr .BS 1
hFiles .BS FILES.MAX
LineCntPtr .BS 1
.BS 1 for inc inc
LineCnts .BS FILES.MAX*2
hLineBuf .BS 1
LineBufPtr .BS 2
CC.CmdSave .BS 1
CC.hDefineBuf .BS 1
CC.hDefines .BS 1
CC.SaveDefine .BS 2
CC.hTags .BS 1
CC.hStack .BS 1
CC.hScopes .BS 1+SCOPE.MAX 1 Global+ MAX locals
CC.CPSID .BS 2 AA
CC.CPSPFX .BS 5 X_id\0
*--------------------------------------
CC.hSymBuf .BS 1
CC.SymID .BS 2
CC.SymIDSave .BS 2
CC.ArgBuf .BS SYM
*--------------------------------------
CC.LookupSymSize .BS 2
CC.LookupSymPtr .BS 2
CC.LookupIdx .BS 1
CC.hLookupBufs .BS LOOKUP.MAX
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s
ASM