A2osX/BIN/CC.S.txt
2022-08-20 16:37:37 +02:00

1066 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
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.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.DefSize .EQ 3
SYM.SizeOf .EQ 4
SYM.Addr .EQ 6
SYM.Def .EQ 8 Funtions : fTQ,a1TQ,a2TQ....
*
SYM .EQ 10
*--------------------------------------
* 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.ENV.INCLUDE .DA ENV.INCLUDE
*--------------------------------------
L.CC.AOPS .DA CC.AOPS
L.CC.PREOPS .DA CC.PREOPS
J.CC.PREOPS .DA CC.EXP.Ref
.DA CC.EXP.Deref
.DA CC.EXP.Abs
.DA CC.EXP.negate
.DA CC.EXP.lnot
.DA CC.EXP.bnot
.DA CC.EXP.preinc
.DA CC.EXP.predec
L.CC.POSTOPS .DA CC.POSTOPS
J.CC.POSTOPS .DA CC.EXP.postinc
.DA CC.EXP.postdec
.DA CC.EXP.array
.DA CC.EXP.Struct
.DA CC.EXP.pStruct
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 CC.DIR.DEFINE
.DA CC.DIR.INCLUDE
*--------------------------------------
J.CC.KW .DA CC.KW.IF
.DA CC.KW.WHILE
.DA CC.KW.ELSE
.DA CC.KW.DO
.DA CC.KW.FOR
.DA CC.KW.SWITCH
.DA CC.KW.CASE
.DA CC.KW.DEFAULT
.DA CC.KW.BREAK
.DA CC.KW.CONTINUE
.DA CC.KW.RETURN
*--------------------------------------
.DA CC.KW.SIZEOF
.DA CC.KW.STRUCT
*--------------------------------------
J.CC.KW.END .DA CC.KW.IF.END
.DA CC.KW.WHILE.END
.DA CC.KW.ELSE.END
.DA CC.KW.DO.END
.DA CC.KW.FOR.END
*--------------------------------------
J.CC.SCSPEC .DA CC.SCSPEC.AUTO
.DA CC.SCSPEC.REGISTER
.DA CC.SCSPEC.STATIC
.DA CC.SCSPEC.EXTERN
.DA CC.SCSPEC.TYPEDEF
J.CC.TYPEQUAL .DA CC.TYPE.CONST
.DA CC.TYPE.VOLATILE
J.CC.TYPESPEC .DA CC.TYPE.SIGNED
.DA CC.TYPE.UNSIGNED
.DA CC.TYPE.SHORT
J.CC.TYPES .DA CC.TYPE.VOID
.DA CC.TYPE.CHAR
.DA CC.TYPE.INT
.DA CC.TYPE.LONG
.DA CC.TYPE.FLOAT
J.CC.UTYPES .DA CC.TYPE.UCHAR
.DA CC.TYPE.UINT
.DA CC.TYPE.ULONG
J.CC.STYPES .DA CC.TYPE.SCHAR
.DA CC.TYPE.SINT
.DA CC.TYPE.SLONG
*--------------------------------------
L.CC.MAIN .DA CC.MAIN
L.CC.LIBC .DA CC.LIBC
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.SetValue .DA PCC.SetValue
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.PushValue .DA PCC.PushValue
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 CC.CORE.Init
bcs CS.INIT.RTS
jsr CODE.Init
jsr CC.FIO.FOpen1st
bcs CS.INIT.RTS
*--------------------------------------
CS.RUN.CLOOP jsr CC.CompileFile
cmp #MLI.E.EOF
bne .9
jsr CC.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 CC.FIO.FCreate
bcs .99
jsr CODE.Init
bcs .99
jsr CC.FIO.FOpen1st
bcs .99
*--------------------------------------
.2 jsr CC.CompileFile
cmp #MLI.E.EOF
bne .9
jsr CC.FIO.FClose
bne .2
*--------------------------------------
.8 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
ldx #OptionVars-OptionList-1
.1 cmp OptionList,x
beq .2
dex
bpl .1
bra .90
.2 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 CC.CORE.Quit
>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 lda ZPCCCode+1
sta PCC.FH+PCC.FH.IDATA+1
sec
sbc #$20
sta PCC.FH+PCC.FH.CSSIZE+1
lda ZPCCCode
sta PCC.FH+PCC.FH.CSSIZE
sta PCC.FH+PCC.FH.IDATA
>PUSHW L.MSG.SUMMARY
>PUSHW PCC.FH+PCC.FH.CSSIZE
>PUSHW ZPCCConst
lda ZPCCData+1
>PUSHA
sta PCC.FH+PCC.FH.DSSIZE+1
lda ZPCCData
>PUSHA
sta PCC.FH+PCC.FH.DSSIZE
>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 .AZ "\r\nA2osX C Compiler %d.%d\r\n\r\n"
MSG.USAGE .AS "Usage : CC <option> srcfile.c dstfile\r\n"
.AS " -D : Debug Mode\r\n"
.AS " -T : Trace On"
.AZ "\r\n"
MSG.READING .AZ "*** Reading file: %s\r\n"
MSG.LINKING .AZ "*** Linking..."
MSG.LINKING2 .AZ "*** %H:%18s T/Q=%h/%h, SC=%h, Def=%h, SizeOf=%H, @=%H\r\n"
MSG.GENERATING .AZ "*** Generating: %s\r\n"
MSG.DEBUG .AS "*** pCode=%H, pConst=%H, pData=%H, pStack=%H\r\n"
.AZ " LSP=%h, CSP=%H:%h>%h:%h, ScopeIdx=%h\r\n"
MSG.TRACE .AZ "%5D> %s\r\n"
MSG.RTSTK .AZ "<pBase=%H, pVar=%H, (pVar)=%H, pStack=%H>\r\n"
MSG.ERROR .AZ " %s^\r\n"
MSG.SUMMARY .AZ "*** Compilation OK : Code size=%5D, iData size=%5D, uData size=%5D\r\n"
MSG.NOMAIN .AZ "*** No 'main()' function defined."
*--------------------------------------
OptionList .AS "DdTt"
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
*--------------------------------------
ENV.INCLUDE .AZ "INCLUDE"
ENV.LIB .AZ "LIB"
*--------------------------------------
CC.OPChars .AS "!~+-*/%=&|^<>["
CC.OPChars.Cnt .EQ *-CC.OPChars
*--------------------------------------
* Assignment Operators: = += -= *= /= %= <<= >>= &= ^= |=
*--------------------------------------
CC.AOPS >PSTR "="
>PSTR "+="
>PSTR "-="
>PSTR "*="
>PSTR "/="
>PSTR "%="
>PSTR "<<="
>PSTR ">>="
>PSTR "&="
>PSTR "^="
>PSTR "!="
.HS 00
*--------------------------------------
* Pre Operators: & * + - ! ~ ++ --
*--------------------------------------
CC.PREOPS >PSTR "&" ref
>PSTR "*" deref
>PSTR "+" abs
>PSTR "-" negate
>PSTR "!" logical not
>PSTR "~" bitwise not
>PSTR "++" pre increase
>PSTR "--" pre decrease
.HS 00
*--------------------------------------
* Post Operators: ++ --
*--------------------------------------
CC.POSTOPS >PSTR "++"
>PSTR "--"
>PSTR "["
>PSTR "."
>PSTR "->"
.HS 00
*-- Binary ---- H to L precedence -----
* Arithmetic Operators: * / %
* Arithmetic Operators: + -
* Shift Operators: << >>
* Relational Operators: < > >= < >= == !=
* Bitwise Operators: & | ^ ~
* Logical Operators: && ||
*--------------------------------------
CC.BOPS >PSTR "*"
>PSTR "/"
>PSTR "%"
>PSTR "+"
>PSTR "-"
>PSTR "<<"
>PSTR ">>"
>PSTR "<"
>PSTR "<="
>PSTR ">"
>PSTR ">="
>PSTR "=="
>PSTR "!="
>PSTR "&"
>PSTR "|"
>PSTR "^"
>PSTR "&&"
>PSTR "||"
.HS 00
*--------------------------------------
* Reserved Directives:
*--------------------------------------
CC.DIRS >PSTR "define"
>PSTR "include"
.HS 00
*--------------------------------------
* Reserved Keywords:
*--------------------------------------
CC.KW >PSTR "if"
>PSTR "while"
>PSTR "else"
>PSTR "do"
>PSTR "for"
>PSTR "switch"
>PSTR "case"
>PSTR "default"
>PSTR "break"
>PSTR "continue"
>PSTR "return"
>PSTR "sizeof"
>PSTR "struct"
.HS 00
CC.KW2.IF >PSTR "else"
.HS 00
CC.KW2.DO >PSTR "while"
.HS 00
*--------------------------------------
CC.SCSPEC >PSTR "auto"
>PSTR "register"
>PSTR "static"
>PSTR "extern"
>PSTR "typedef"
.HS 00
*--------------------------------------
CC.TYPEQUAL >PSTR "const" ALL
>PSTR "volatile"
CC.TYPESPEC >PSTR "signed" char,int,long
>PSTR "unsigned" char,int,long
>PSTR "short" int
CC.TYPES >PSTR "void"
>PSTR "char"
>PSTR "int"
>PSTR "long"
>PSTR "float"
.HS 00
*--------------------------------------
CC.Type2FPU .DA #FPU.wMUL,#FPU.iMUL,#FPU.uMUL,#FPU.lMUL,#FPU.fMUL
*--------------------------------------
CC.FTYPES >PSTR "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.LIBC >PSTR "chtyp"
.DA #2,#1,#SYS.ChTyp
>PSTR "chmod"
.DA #2,#1,#SYS.ChMod
>PSTR "fstat"
.DA #2,#1,#SYS.FStat
>PSTR "stat"
.DA #2,#1,#SYS.Stat
>PSTR "mkdir"
.DA #2,#1,#SYS.MKDir
>PSTR "mknod"
.DA #2,#1,#SYS.MKNod
>PSTR "mkfifo"
.DA #2,#1,#SYS.MKFIFO
>PSTR "pipe"
.DA #2,#1,#SYS.Pipe
>PSTR "opendir"
.DA #2,#1,#SYS.OpenDir
>PSTR "readdir"
.DA #2,#1,#SYS.ReadDir
>PSTR "closedir"
.DA #2,#1,#SYS.CloseDir
>PSTR "open"
.DA #2,#1,#SYS.Open
>PSTR "close"
.DA #2,#1,#SYS.Close
>PSTR "read"
.DA #2,#1,#SYS.Read
>PSTR "write"
.DA #2,#1,#SYS.Write
>PSTR "chown"
.DA #2,#1,#SYS.ChOwn
>PSTR "fputc"
.DA #2,#1,#SYS.FPutC
>PSTR "putchar"
.DA #2,#1,#SYS.PutChar
>PSTR "getc"
.DA #2,#1,#SYS.GetC
>PSTR "getchar"
.DA #2,#1,#SYS.GetChar
>PSTR "fputs"
.DA #2,#1,#SYS.FPutS
>PSTR "puts"
.DA #2,#1,#SYS.PutS
>PSTR "fgets"
.DA #2,#1,#SYS.FGetS
>PSTR "ungetc"
.DA #2,#1,#SYS.UngetC
>PSTR "fopen"
.DA #2,#1,#SYS.FOpen
>PSTR "fclose"
.DA #2,#1,#SYS.FClose
>PSTR "fread"
.DA #2,#1,#SYS.FRead
>PSTR "fwrite"
.DA #2,#1,#SYS.FWrite
>PSTR "fflush"
.DA #2,#1,#SYS.FFlush
>PSTR "fseek"
.DA #2,#1,#SYS.FSeek
>PSTR "ftell"
.DA #2,#1,#SYS.FTell
>PSTR "feof"
.DA #2,#1,#SYS.FEOF
>PSTR "remove"
.DA #2,#1,#SYS.Remove
>PSTR "rename"
.DA #2,#1,#SYS.Rename
>PSTR "printf"
.DA #2,#1,#SYS.PrintF
>PSTR "fprintf"
.DA #2,#1,#SYS.FPrintF
>PSTR "sprintf"
.DA #2,#1,#SYS.SPrintF
>PSTR "scanf"
.DA #2,#1,#SYS.ScanF
>PSTR "fscanf"
.DA #2,#1,#SYS.FScanF
>PSTR "sscanf"
.DA #2,#1,#SYS.SScanF
* >PSTR "$50"
* .DA #2,#1,#0
* >PSTR "$52"
* .DA #2,#1,#0
* >PSTR "$54"
* .DA #2,#1,#0
* >PSTR "$56"
* .DA #2,#1,#0
* >PSTR "$58"
* .DA #2,#1,#0
* >PSTR "$5A"
* .DA #2,#1,#0
* >PSTR "$5C"
* .DA #2,#1,#0
>PSTR "setattr"
.DA #2,#1,#SYS.SetAttr
* >PSTR "mount"
* .DA #2,#1,#0
* >PSTR "umount"
* .DA #2,#1,#0
* >PSTR "online"
* .DA #2,#1,#0
* >PSTR "getstkobj"
* .DA #2,#1,#0
* >PSTR "shift"
* .DA #2,#1,#0
* >PSTR "argv"
* .DA #2,#1,#0
* >PSTR "argvDup"
* .DA #2,#1,#0
* >PSTR "geterrmsg"
* .DA #2,#1,#0
>PSTR "atof"
.DA #2,#1,#SYS.AToF
>PSTR "atoi"
.DA #2,#1,#SYS.AToI
>PSTR "atol"
.DA #2,#1,#SYS.AToL
>PSTR "strtof"
.DA #2,#1,#SYS.StrToF
>PSTR "strtol"
.DA #2,#1,#SYS.StrToL
>PSTR "strtoul"
.DA #2,#1,#SYS.StrToUL
>PSTR "realpath"
.DA #2,#1,#SYS.RealPath
>PSTR "expand"
.DA #2,#1,#SYS.Expand
>PSTR "strlen"
.DA #2,#1,#SYS.StrLen
>PSTR "strcpy"
.DA #2,#1,#SYS.StrCpy
>PSTR "strcat"
.DA #2,#1,#SYS.StrCat
>PSTR "strdup"
.DA #2,#1,#SYS.StrDup
>PSTR "strupr"
.DA #2,#1,#SYS.StrUpr
>PSTR "strlwr"
.DA #2,#1,#SYS.StrLwr
>PSTR "strcmp"
.DA #2,#1,#SYS.StrCmp
>PSTR "strcasecmp"
.DA #2,#1,#SYS.StrCaseCmp
* >PSTR "getdevbyname"
* .DA #2,#1,#0
* >PSTR "getdevstatus"
* .DA #2,#1,#0
* >PSTR "mkdev"
* .DA #2,#1,#0
* >PSTR "ioctl"
* .DA #2,#1,#0
* >PSTR "loadlib"
* .DA #2,#1,#0
* >PSTR "unloadlib"
* .DA #2,#1,#0
* >PSTR "loaddrv"
* .DA #2,#1,#0
* >PSTR "insdrv"
* .DA #2,#1,#0
>PSTR "execl"
.DA #2,#1,#SYS.ExecL
* >PSTR "execv"
* .DA #2,#1,#0
>PSTR "fork"
.DA #2,#1,#SYS.Fork
>PSTR "kill"
.DA #2,#1,#SYS.Kill
* >PSTR "loadfile"
* .DA #2,#1,#0
* >PSTR "loadtxtfile"
* .DA #2,#1,#0
* >PSTR "filesearch"
* .DA #2,#1,#0
* >PSTR "getmemstat"
* .DA #2,#1,#0
* >PSTR "strvnew"
* .DA #2,#1,#0
* >PSTR "strvset"
* .DA #2,#1,#0
* >PSTR "strvget"
* .DA #2,#1,#0
* >PSTR "strvfree"
* .DA #2,#1,#0
>PSTR "putenv"
.DA #2,#1,#SYS.PutEnv
>PSTR "setenv"
.DA #2,#1,#SYS.SetEnv
>PSTR "getenv"
.DA #2,#1,#SYS.GetEnv
>PSTR "unsetenv"
.DA #2,#1,#SYS.UnsetEnv
>PSTR "time"
.DA #2,#1,#SYS.Time
>PSTR "strftime"
.DA #2,#1,#SYS.StrFTime
* >PSTR "ptime2time"
* .DA #2,#1,#0
>PSTR "ctime2time"
.DA #2,#1,#SYS.CTime2Time
>PSTR "md5"
.DA #2,#1,#SYS.MD5
>PSTR "md5init"
.DA #2,#1,#SYS.MD5Init
>PSTR "md5update"
.DA #2,#1,#SYS.MD5Update
>PSTR "md5finalize"
.DA #2,#1,#SYS.MD5Finalize
>PSTR "getpwuid"
.DA #2,#1,#SYS.GetPWUID
>PSTR "getpwname"
.DA #2,#1,#SYS.GetPWName
>PSTR "putpw"
.DA #2,#1,#SYS.PutPW
>PSTR "getgrpgid"
.DA #2,#1,#SYS.GetGRGID
>PSTR "getgrpname"
.DA #2,#1,#SYS.GetGRName
>PSTR "putgr"
.DA #2,#1,#SYS.PutGR
* >PSTR "opensession"
* .DA #2,#1,#0
* >PSTR "closesession"
* .DA #2,#1,#0
* >PSTR "slistgetdata"
* .DA #2,#1,#0
* >PSTR "slistadddata"
* .DA #2,#1,#0
* >PSTR "slistsetdata"
* .DA #2,#1,#0
* >PSTR "slistgetbyid"
* .DA #2,#1,#0
* >PSTR "slistnewkey"
* .DA #2,#1,#0
* >PSTR "slistlookup"
* .DA #2,#1,#0
* >PSTR "slistfree"
* .DA #2,#1,#0
* >PSTR "slistnew"
* .DA #2,#1,#0
>PSTR "malloc"
.DA #2,#1,#SYS.GetMem
>PSTR "realloc"
.DA #2,#1,#SYS.Realloc
* >PSTR "getmemptr"
* .DA #2,#1,#0
>PSTR "free"
.DA #2,#1,#SYS.FreeMem
* >PSTR "newstkobj"
* .DA #2,#1,#0
* >PSTR "loadstkobj"
* .DA #2,#1,#0
* >PSTR "getstkobjptr"
* .DA #2,#1,#0
* >PSTR "freestkobj"
* .DA #2,#1,#0
*--------------------------------------
>PSTR "pwr"
.DA #2,#2,#FPU.PWR
>PSTR "log"
.DA #2,#2,#FPU.LOG
>PSTR "sqr"
.DA #2,#2,#FPU.SQR
>PSTR "exp"
.DA #2,#2,#FPU.EXP
>PSTR "cos"
.DA #2,#2,#FPU.COS
>PSTR "sin"
.DA #2,#2,#FPU.SIN
>PSTR "tan"
.DA #2,#2,#FPU.TAN
>PSTR "atan"
.DA #2,#2,#FPU.ATAN
>PSTR "lrintf"
.DA #2,#2,#FPU.QINT
.HS 00
*--------------------------------------
.INB usr/src/bin/cc.s.pcc
*--------------------------------------
.DUMMY
.OR 0
DS.START
PathBuf .BS MLI.MAXPATH+1
bDebug .BS 1
bTrace .BS 1
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