.title $$main Start of C programs .ident "V02.00" ;+ ; Index Start of C programs ; ; Usage ; ; Internal ; ; $$main:: /* Start of C programs */ ; ; extern int $$uic; /* RSX: Default uic */ ; extern int $$stnd; /* Stack end point */ ; extern char $$task[]; /* RSX: task name */ ; ; Description ; ; This module contains the run-time startoff for C programs. ; It initializes the C environment and calls the main() subroutine. ; On return from the main program, exit() is called to flush the ; output buffer and return to the operating system. The following ; is a list of internal symbols used by the C run-time. ; ; $$stnd The (top) end of the stack on entrance. ; $$task The task name in ascii. ; $$uic The default UIC word from GTSK$. ; $$mend End of untouched memory ; $$argc Number of command args ; $$argv Pointer to argv array ; ; Internal ; ; All $$ values are for internal communication among runtime ; library routines. (I.E. leave them alone!) ;- ; Edit history: ; V02.00 19-Oct-82 TTC Rework of old CS library ; .psect c$data $$stnd:: .blkw 1 ; High-point of stack $$argc:: .word 0 ; Number of command args $$argv:: .word 0 ; -> argv[] $$mend:: .word 0 ; End of untouched memory $$mlim:: .limit ; Memory limits $$mtop == $$mlim+2 ; We need first byte unused $$bsiz == 132. ; Default output buffer size $$bbeg:: .word 0 ; Pointer to beginning of output buffer $$bptr:: .word 0 ; Pointer into output buffer $$bend:: .word 0 ; Pointer to end of output buffer ; ; RSX-specific global data. ; $$uic:: .blkw 1 ; Task default uic from GTSK$ $$task:: .ascii "??????" ; Gets the task name .byte 0 ; Null terminated. .even .psect c$code ; ; Run time startoff. ; Called from the operating system ; $$main:: mov sp,$$stnd ; Save end of stack clr r5 ; No environment linkage yet call $$init ; Initialize everything mov $$argv,-(sp) ; Arg. vector mov $$argc,-(sp) ; Arg. count call main ; Call user program jmp exit ; Normal exit .end $$main