.title cioina ;;*** ; ; assembly-language module for CIOINI, ; the initialization routine for the PL/I-compatible C I/O runtime. ; derived from C's INIT module. RSX version (??). ; make sure PL/I-compatible versions of changed modules are loaded ; (IOV, SUPORT, and IOFLUN are already brought in by references in code): .globl malloc, fclose ;;*** ;;*** .title $$init One-time initialization code ;;*** .ident /000022/ .mcall OPEN$W, GTSK$S ISRSTS = 4 ; Returned by GTSK$ for RSTS ISVMS = 5 ; Returned by GTSK$ for VMS ISMPLUS = 6 ; Returned by GTSK$ for RSX-11M+ .psect .prog. cioina:: ;;*** jsr r5,csv$ ;Link environments ; ; Do a get task to get the task name and default UIC ; GTSK$S #$$erec ;Get task parameters ;;*** mov #2,(sp) ;Get task name (2 words) ;07 ;*TMP* mov #2,-(sp) ;;*** ;*TMP* mov #$$erec+<0.*2>,-(sp) ;From here ;*TMP* mov #$$task,-(sp) ;To here ;*TMP* call r50toa ;Using C library routine ;;*** cmp (sp)+,(sp)+ ;Cleanup stack ;07 ;;*** clr (sp) ;Assume no task name needed ;12/14/22 ;*TMP* add #6,sp ;;*** mov $$erec+<7.*2>,$$uic ;Default uic word (word 07) mov $$erec+<14.*2>,$$opsy ;Op. system unique code cmp $$opsy,#ISRSTS ;Good old RSTS? bne 40$ ;Not today inc $$rsts ;Here's someone who knows better ;;*** clr (sp) ;No task name for RSTS ;14 40$: ; cmp $$opsy,#ISVMS ;VMS? ;10+ bne 45$ ;No ;22 mov #"CO,$$efnb+N.DVNM ;Yes, output to CO: inc $$vms ;Set flag ;12 ;;*** mov #$$task,(sp) ;Task name needed -- Note: this may ;22+ ;;*** ; be version-specific. It is needed ;;*** ; on versions V2.3 and V2.4 45$: ;17-/22- jsr pc,$$glun ;get a lun from PL/I ;;*** movb r3,$$eiov+V$LUN ;;*** OPEN$W #$$efdb ;Open error file ;;*** bcc 46$ ;Ok, continue ;;*** CRASH ;Die. ;;***46$: ;10- mov $$efdb+F.ERR,r0 ;return error code ;;*** jmp cret$ .end