HP 3000 Manuals

Use Y Register [ HP EDIT Reference Manual ] MPE/iX 5.0 Documentation


HP EDIT Reference Manual

Use Y Register 

Purpose 

Sets or retrieves the Y register.

Default Syntax 

[n] $y

where n represents a count that, if specified, moves to the Y register.

Description 

This command enables you to pass integers to and from macros and the HP
EDIT calculator Y register.  The Y register resides directly below the X
register on the four-register computational stack.

Specifying A Count 

If you specify a count before executing this command, the value is saved
in the Y register, replacing the previous value.  If you do not specify a
count, HP EDIT places the current value of the Y register into the count
for use by the next command.

Ordinarily, if you specify a count before executing a macro, the macro
repeats the number of times specified.  However, if the Use Y Register
command is the first command executed within the macro, the specified
count is loaded into the Y register and the macro executes only once.
This process enables you to use the Y register to pass a parameter (the
count) to a macro.
[REV DEL]

Syntax Considerations 

In order to use this command within a macro, you must properly construct
the macro using correct syntax.  Refer to the Define Macro command for
information about required syntax.

Since the standard Meta key (ESC) is displayed as ^[ when inserted in a
macro, HP EDIT provides the dollar sign ($) as an alternate Meta key.
Consequently, you should use the recommended syntax of $y within a macro.

Procedure 

To place a value in the Y register: 

   1.  Type a count representing the value desired.

   2.  Press ESC and the y key.  HP EDIT stores the value in the Y
       register.

To retrieve the Y register value: 

   1.  Press ESC and the y keys.  HP EDIT displays the value of the Y
       register as a count on the message line.

Examples 

To interactively delete the next n lines, where n represents the current 
Y register value: 

   1.  Press ESC and the y key.  HP EDIT displays the value of the Y
       register as the count on the message line.

   2.  Execute the Delete Line (D) command.  HP EDIT deletes the number
       of lines displayed as the count.

To interactively subtract the distance to mark 3 from the distance to 
mark 4: 

   1.  Type the number 3 as a count.

   2.  Execute the Set Distance To Mark (#) command.  HP EDIT displays
       the distance as the count on the message line.

   3.  Press ESC and the x key.  HP EDIT stores the distance in the X
       register.

   4.  Type the number 4 as a count.

   5.  Execute the Set Distance To Mark (#) command.  HP EDIT displays
       the distance as the count on the message line.

   6.  Press ESC and the y key.  HP EDIT stores the distance in the Y
       register.

   7.  Press ESC and the + key.  HP EDIT displays the following prompt:

            Calculate:

   8.  Type - and press Return.  The calculator subtracts the X register
       from the Y register and places the result in the X register.  HP
       EDIT displays the following X and Y values:

            X = n   Y = 0

       where n represents the difference between the two distances.

Related Commands 

       Calculate
       Use Y Register



MPE/iX 5.0 Documentation