.TITLE ALUNX Assign LUN (Extended) .IDENT "V1.0" .ENABL LC .PSECT C$CODE ;+ ; Index ALUNX Assign LUN (Extended) ; ; Usage ; #include ; word lun; /* Logical Unit Number */ ; char *dnam; /* Device name string */ ; word unit; /* Device unit number */ ; word status; /* Returned DSW */ ; ; status = alunx(lun, dnam, unit); ; ; Description ; ; This version of the assign LUN directive has been added to ; make it easier to use from C. The alun() function requires that ; the 2-character device name be packed into a word and passed ; by value. That was in keeping with the general philosophy ; of keeping the mapping between the C call and the MACRO usage ; as close as possible. However, packing the device name requires ; a hack such as the use of a union, and useless run-time code to ; fill in the union since DECUS C cannot initialize a union. ; ; alunx() takes the device name as a string, the address of ; which is passed as the parameter. Only the first two letters ; of the string are used, so the string may be an entire file ; specification which begins with an explicit device name, or may ; be the device name field of an FNB. ; ; The most common usage, however, will be: ; ; status = alunx(lun, "XX", unit); ; ; Notes ; ; Only the 1st two characters of the string are used. ; ; No null is needed at the end of the string, so the ; address passed may be that of the device name field ; of an FNB. ; ; No checks are made for the validity of the characters, ; whatever is given will be passed to the directive. ; ; The string need not be word-aligned. ; [end] ;- ; Edits: ; V1.0 19-Oct-82 RBD Initial edit. ; .mcall alun$s alunx:: mov sp,r0 ; r0 --> entry stack mov 4(r0),r1 ; r1 --> Device name mov r2,-(sp) ; Save r2 clr r2 ; r2 will get packed name bisb 1(r1),r2 ; Get second char (unsigned) swab r2 ; Put it in hi byte bisb (r1),r2 ; Add in 1st char in lo byte alun$s 2(r0),r2,6(r0) ; Issue directive mov $dsw,r0 ; Return DSW mov (sp)+,r2 ; Restore r2 return .end