.title smain Small main .ident "V02.00" ;+ ; Index Small main C program entry point ; ; Usage ; ; When task build, smain must be explicitly specified so ; that it is used instead of the main in the library. ; ; Description ; ; Small main may used to generate smaller task images for ; tasks that do not use or do not wish to use dynamic ; memory allocation, the command line, the command line prompt ; string and the fancy trap catching. This version of main ; also maintains a static 132. byte output buffer. ; ;- ; Edit history ; 19-Oct-82 TTC Initial edit ; .MCALL ALUN$S .PSECT C$DATA $$BSIZ = 132. ; Default output buffer size $$BUF: .BLKB $$BSIZ ; Output buffer $$BBEG:: .WORD $$BUF $$BEND:: .WORD $$BUF+$$BSIZ ; Pointer to end of output buffer $$BPTR:: .WORD $$BUF ; pointer into outbuf buffer .EVEN .PSECT C$CODE ; ; Run time startoff. ; Called from the operating system ; $$MAIN:: CLR R5 ; No environment linkage yet ALUN$S #tty.lun,#"TI,#0 ; Assign terminal lun CALL MAIN ; Call user program JMP EXIT ; Normal exit ; ; save R4-R2 and make a one-word temp slot on the stack. ; CSV$:: SUB #10,SP ; MAKE ROOM FOR STACK FRAME MOV R5,(SP) ; PUT ENTRY POINT IN TEMP SLOT MOV SP,R5 ; R5 --> TEMP SLOT TST (R5)+ ; R5 --> R2 SAVE SLOT MOV R2,(R5)+ ; SAVE R2; R5 --> R3 SAVE SLOT MOV R3,(R5)+ ; SAVE R3; R5 --> R4 SAVE SLOT MOV R4,(R5)+ ; SAVE R4; R5 --> R5 SAVE SLOT JMP @(SP) ; ENTER ROUTINE ; ; pop R2-R4 and restore stack linkage registers. ; CRET$:: MOV R5, R2 MOV -(R2), R4 MOV -(R2), R3 MOV -(R2), R2 MOV R5, SP MOV (SP)+, R5 RTS PC .END $$MAIN