From: "(Jon Pinkley, Westinghouse (216)486-8300 x1335)"
Newsgroups: vmsnet.internals
Subject: RE: Problems with DISM32 - DCL prompt length
Date: Sat, 12 Sep 92 19:32:47 -0400
Organization: Macro32<==>Vmsnet.Internals Gateway
X-Gateway-Source-Info: Mailing List

John Hawkinson, (jhawk@panix.com) posts to vmsnet.internals:

>  I just got a copy of DISM32, and I'm having some weird problems --
>It spits out a bunch of FORTRAN errors at me when I run it on DCL.EXE
>(some other things, too); could these have to do with it needing to be
>relinked? I'm running VMS 5.5.  Anyway, here's what it says:

[traceback output and description of how he attempted to get DISM32 to use
symbolic definitions from DCLDEF.STB omitted]

John,

I just tried this on VMS V5.4-2 and it worked.  There were a lot of
messages about indirect jumps, but it completed without any
tracebacks.

What version of DISM32 are you using?  Look at the .MAR file that is
produced, it has a version number in the heading.  I am using DISM32
V4.3

Here is the beginning of the generated DCL.MAR file:

        .TITLE  DCL SYS$COMMON:[SYSEXE]DCL.EXE;2 Disassembly
        .IDENT  /X-27/
;
;  Disassembly of SYS$COMMON:[SYSEXE]DCL.EXE;2
;       on 12-SEP-1992 15:05:09.20 by VAX/VMS DISM32 V4.3
;
;  as linked by LINK-32 V05-05 on  2-NOV-1990 13:07:41.20
;
;  image ID = X-27, type shareable (IHD$K_LIM)
;  contains     1 image sections
;
;  header contains 1 blocks
;  image contains     0 blocks of debug symbol table data,
;    and     4 records of global symbol table data
;
;  global section major ID: %X'03', minor ID: %X'000000'
;      match control: ISD$K_MATLEQ
;  linker flags:  PICIMG  DBGDMT (V4+)
;  I/O channel count =   0, image I/O count =   0
;  system version:
;  requested privilege mask = FFFFFFFF FFFFFFFF
;
;  no patches made to this image
;
;   transfer addresses:
;       00000076 DCL$MAIN
;

>Anyway, the reason I'm doing this (in case you missed my prev. post)
>was I'm trying to figure out how to patch DCL to use a prompt longer
>than 32 chars (which is probably a hopeless task). ...

As far as the problem you are trying to solve, i.e. increase the max
size of a DCL Prompt, I can't give you any good news.  The symbol
ent_k_max_prompt is what controls the size of the DCL prompt buffer.
It is defined by [v55.dcl.lis]clitabdef.sdl if you can get ahold of
the VMS listing CD.  Of course if you had that you wouldn't need to
disassemble things. Unfortunately, since it is a constant, and it is
used in code sequences like the following (extracted from
[v55.dcl.lis]set.lis after a pass through cvtlis)

.set plug on

Here's a plug for getting the CD listing kit.  If you work with
internals, they are indispensible.  Working with disassembly
listings is far better than trying to use SDA's exam/instr, but is
nowhere near as useful as seeing the commentary available in the
listings.  Also, in cases like this, where symbols are used as
constants in the code, the disassembly is nearly useless.  Using
search on the listing files makes finding answers to this kind of
problem quite trivial.  You can get on a "subscription" to updates
added to your software maintenance contract.  The V5.5-1 update was
sent out in a very timely manner, some previous updates have
unfortunately lagged the general release by a couple months.

Here's the an extract from the output of a disassembly of DCL.EXE
(VMS V5.4-2) using DISM32 V4.3

LB_0000A64D:
        MOVW    L^STR_0000004E,W^241(R11)
        BISB2   S^#1,B^104(R11)
        BSBW    S_000095A6
        CMPB    R5,S^#0
        BNEQ    LB_0000A670
        BLBC    R3,LB_0000A66D
        CLRW    W^241(R11)
        BICB2   S^#1,B^104(R11)
LB_0000A66D:
        BSBW    S_000095A6
LB_0000A670:
        BSBW    S_000095A6
        CMPB    R5,S^#4
        BNEQ    LB_0000A689
        MOVL    L^L_00000050,W^243(R11)
        MOVB    I^#^X05,W^240(R11)
        BRB     LB_0000A6A1
LB_0000A689:
        MOVL    I^#^X000388FA,R0
        CMPL    R1,S^#32
        BGTRU   LB_0000A6A8
        ADDB3   S^#3,R1,W^240(R11)
        MOVC3   R1,(R2),W^244(R11)
LB_0000A6A1:
        MOVL    I^#^X00030001,R0
LB_0000A6A8:
        RSB

Now the same code sequence from the V5.5 listings (doesn't look like
much has changed.  This was extracted from the output of

$ cvtlis [v55.dcl.lis]set.lis  ! Hunter Goatley's .LIS to source converter
$                              ! so we can get 80 col output
        .SBTTL  SET PROMPT
;+
; DCL$SETPROMPT - SET PROMPT
;
; THIS ROUTINE IS CALLED AS AN INTERNAL COMMAND TO EXECUTE THE SET PROMPT
; DCLS COMMAND.
;
; INPUTS:
;
;       R8 = ADDRESS OF SCRATCH BUFFER DESCRIPTOR.
;       R9 = ADDRESS OF SCRATCH STACK.
;       R10 = BASE ADDRESS OF COMMAND WORK AREA.
;       R11 = BASE ADDRESS OF PROCESS WORK AREA.
;
; OUTPUTS:
;
;       THE DCL PROMPT STRING IS CHANGED.
;-
DCL$SETPROMPT::                         ;SET PROMPT
        MOVW    DCL$CRLF,PRC_W_PMPTCTRL(R11);ASSUME /CONTROL
        SETBIT  PRC_V_CARRCNTL,PRC_W_FLAGS(R11)  ;SET CR/LF FLAG
        BSBW    DCL$GETDVAL             ;GET FIRST TOKEN
        CMPB    R5,#PTR_K_COMDQUAL      ;/[NO]CONTROL QUALIFIER?
        BNEQ    20$                     ;NO, THEN BRANCH
        ASSUME  PTR_V_NEGATE EQ 20      ;
        BLBC    R3,10$                  ;BRANCH IF NOT NEGATED
        CLRW    PRC_W_PMPTCTRL(R11)     ;SET NOCONTROL
        CLRBIT  PRC_V_CARRCNTL,PRC_W_FLAGS(R11)  ;INDICATE NO CR/LF
10$:    BSBW    DCL$GETDVAL             ;GET "PROMPT" TOKEN
20$:    BSBW    DCL$GETDVAL             ;GET PROMPT STRING
        CMPB    R5,#PTR_K_ENDLINE       ;IF PRESENT
        BNEQ    30$                     ;THEN RESET THE PROMPT
        MOVL    DCL$T_PROMPT,-          ;ELSE RESTORE THE DEFAULT
                PRC_B_CONTINUE(R11)     ;
        MOVB    #DCL$C_PROMPTLEN,-      ;
                PRC_B_PROMPTLEN(R11)    ;
        BRB     80$                     ;DONE
30$:    MOVL    #CLI$_STRTOOLNG,R0      ;ASSUME STRING IS TOO LONG
        CMPL    R1,#ENT_K_MAX_PROMPT    ;IS IT TOO LONG?
        BGTRU   90$                     ;YES, THEN ERROR
        ASSUME  ENT_K_MAX_PROMPT LT 256 ;
        ADDB3   #3,R1,-                 ;SAVE LENGTH OF PROMPT
                PRC_B_PROMPTLEN(R11)    ;
        MOVC3   R1,(R2),PRC_G_PROMPT(R11) ;SAVE PROMPT STRING
80$:    STATUS  NORMAL                  ;RETURN NORMAL STATUS
90$:    RSB

Isn't that a bit more clear than the output of DISM32?  This isn't a
putdown on DISM32, I use it too.  It is useful when you get
replacement patches from DEC that aren't in the listings kit.  But
given a choice of looking at a bunch of VAX instructions without any
useful symbolic constants, and the actual listing files with
comments, I'll chose the listings.

.set plug off

This is not the only occurrence of the symbol in the listings, there
are many references to it, so there isn't a simple patch that I can
think of.

Note that the prompt is stored in the DCL entity block in the
variable portion.  It would be relatively easy for DEC to create a
sysgen parameter with a default value of 32, a min value of 32, a
max value of 250 (less than 255 because it looks like they add three
to the prompt length in several places) and then load the P1 area
accordingly.  Of course if they did this Hunter may have to make
some changes to his prompt setting program.

It appears to me that there is a latent bug in the above code,
specifically the

        ASSUME ENT_K_MAX_PROMPT LT 256

should be

        ASSUME ENT_K_MAX_PROMPT LT 253 ; (256 - 3) perhaps even less?

If someone at DEC were to change the CLITABDEF.SDL to define
max_prompt to be 255, the assembly of SET would still work, but the
generated code would not.  Specifically, look at what will be
deposited into prc_b_promptlen.

Jon Pinkley jon@clevax.wec.com  ...uunet!tron!clevax!jon (216)486-8300 x1335