• Keine Ergebnisse gefunden

Stack Control Orders

Im Dokument '-Graphics System (Seite 176-180)

i !

\..__./

Data Word 2 Variable: Address

Stack Control Orders

X'aaaa' This 16-bit word represents an absolute address within the page (specified in X'pppp' above) to which you want to branch.

Valid values are in the range from 0 to 65,534. The low-order bit of the address is ignored.

The GBP AGE order allows the display program to branch to an address on another page.

Nine stack orders are defined that specify the size and location of the stack and control the pushing and popping of data to and from the stack. This section describes these stack orders and the stack format. The stack is used to store orders requested by the stack control orders.

The stack control orders are described in the order shown in the following table.

For each order the table indicates mnemonic form and name plus a brief statement of the function of the order.

Note: The internal operation of the stack is described in this section to assist the user in debugging only. The internal operation is subject to change in the future and should not be relied on to remain unchanged by using this knowledge to perform programming, etc.

Mnemonic Name Function

GLSR Load Stack Register Specifies stack characteristics and initializes the stack GSSR Store Stack Register Stores stack register data

at a specified address GBAPL Branch after Push Link Writes a Branch Page

(GBPAGE) order into the stack and branches to a page /byte address

GBAPLS Branch after Push Link Writes a Branch Page

Short (GBPAGE) order into the stack

and branches to a byte address GPATR Push Attribute Register Writes a Load Attribute

Register (GLATR) order into the stack

GPCDP Push Current Draw Writes a Draw Line Absolute

Position 3D 16 Bits (GDLA3L) order

into the stack

GPSMC Push Stack Marker Writes a stack marker

Code (X'2ABO') into the stack

GPOPNOP Pop Stack and Removes orders from the No-Operation stack without processing

them

GPOP Pop Stack Reads orders from the top of

the stack

Before information can be pushed into a stack, a Load Stack Register (GLSR) order is issued to specify the stack characteristics and initialize the stack. The stack is initialized by writing X'2AFEOOOO' at the display storage address defined by the stack initial pointer, and setting the stack current pointer to the stack initial pointer plus 2 if registers 4 and 5 are not specified; otherwise, the values of registers 4 and 5 are used as the stack current pointer.

An empty stack is signified by a stack current pointer addressing a length field of X'OOOO'.

Each push order writes an appropriate order into the stack by:

Incrementing the stack current pointer by 2.

Writing the order at the location specified by the stack current pointer.

Writing X'2AFE' after the order.

Writing the length of the order in the next 2 bytes.

Assuming prior stack initialization and push processes, a nonempty stack has the format:

2AFEOOOO (Order, 2AFE, Length of Order) ... (Order, 2AFE, Length of Order)

The bracketed information is repeated for each order pushed into the stack. The stack current pointer always points to the last length field in the stack.

A pop operation reads and processes the order on top of the stack. The first byte of this order is located using the stack current pointer location and the contents of the length field to which it is pointing. Following each pop operation the current pointer points to the length field following the order that is on top of the stack.

The pop operation is then repeated for the new order at the top of the stack unless it is a stack marker or a GBP AGE order placed there by a Push Stack Marker order or a Branch after Push Link or a Branch after Push Link Short order, respe.ctively. If the current pointer is at a length field containing X'OOOO', and a pop order is used, a stack error is issued, since the stack is assumed to be empty.

The exception conditions that cause a stack error are:

A pop operation is requested while the stack is empty (the stack current pointer points to a length field of zero).

During the processing of a push order, the stack current pointer becomes equal to or greater than the stack limit pointer.

If a stack error occurs, the graphic order program is terminated, the host is interrupted, and Attention/Unit Check bits are presented. Sense byte 1, bit 7 and byte 4, bit Sare set to 1; sense bytes 6 and 7, 8 and 9, 2 and 3, and 12 and 13 contain the stack page number, stack initial pointer, stack current pointer, and stack limit pointer, respectively.

Note: Processing orders other than those created and pushed into the stack by push orders (defined both elsewhere in this section and in "TCP Stack Control Orders" on page 5-101) yields unpredictable results. Processing of this sort

l I

~

u

would occur only as a result of a user error, such as setting the stack current pointer incorrectly or moving data or orders into the stack area through the use of a Move Data Block (GMVBLK) order, and so on, with an incorrect address.

GLSR-Load Stack Register

Data Word Variables

The GLSR order specifies the size, location and current pointer of the stack, and initializes the stack. The size and location are defined by the stack initial pointer and stack limit pointer. These pointers, along with the stack current pointer, define the display storage addresses within the page specified by the stack location page number. Because the stack cannot span pages, all pointers must have the same page number. The stack is initialized by writing X'2AFEOOOO' at the location defined by the stack initial pointer.

If neither register 4 or 5 is specified, the stack current pointer (registers 4 and 5) is set equal to the stack initial pointer (registers 2 and 3) plus 2. Otherwise, if either register 4 or 5 is specified, the stack current pointer is set to the value of registers 4 and 5.

The GLSR order is followed by a variable-length data list containing one or more words.

The format of the GLSR order is:

'---~~_P_M_c_~_d_e_)

__.__D_a_t_a_w_o_r_d __ }

~-D-at_a_w_or_d___.

1 1 n

Data List

-The GLSR order contains the following values:

Name Bit(s) Value

Set Mode 0-7 X'28' or X'2A'

Mode Control 8-15 X'DS'

Data Word 1 0 B'e'

1-3 B'OOO'

4 B'O'

5-7 B'ttt'

8-15 B'c ... c'

B'e' Last-word indicator e=O

e = 1

Not the last word; more words to follow.

Last word in data list.

B'ttt' Stack register number

B'c ... c' Data bits to be set into the appropriate stack register.

Data List

This order causes the stack registers indicated in the data list to be loaded with the values specified by the associated c bits. Registers not referred to are not

changed.

The formats, contents, and associated default values of the stack registers are:

Value at

No. of GB GOP

Bits Format and Start

Stack Location Page Number, High Byte 8 xxxx xxxx X'OO' Stack Location Page Number, Low Byte 8 xxxx xxxx X'OO'

Stack Initial Pointer, High Byte 8 xxxx xxxx X'OO'

Stack Initial Pointer, Low Byte 8 xxxx xxxx X'OO'

Stack Current Pointer, High Byte 8 xxxx xxxx X'OO'

Stack Current Pointer, Low Byte 8 xxxx xxxx X'OO'

Stack Limit Pointer, High Byte 8 xxxx xxxx X'OO'

Stack Limit Pointer, Low Byte 8 xxxx xxxx X'OO'

The contents and function of each stack register are described below:

Registers 0 and 1-Stack Location Page Number

These registers contain a 16-bit page number (the high-order 8 bits are in register 0 and the low-order 8 bits are in register 1) of the page in which the stack is located. The stack cannot span pages. See "Display Storage Page Numbering" on page 3-2 for information on how to determine valid page numbers for your processor.

Registers 2 and 3-Stack Initial Pointer

These registers contain the 16-bit stack initial pointer (the high-order 8 bits are in register 2 and the low-order 8 bits are in register 3) specifying the lower limit of the stack address space within the page specified in stack registers 0 and 1.

• Registers 4 and 5 -Stack Current Pointer

These registers contain the 16-bit stack current pointer (the high-order 8 bits are in register 4 and the low-order 8 bits are in register 5) that is used to locate the order on top of the stack. This pointer is always the address of a length field containing the length of the order on top of the stack. An empty stack is signified by a length field containing X'OOOO'. If a pop operation is requested when the stack is empty, the operation is not executed; the display program is terminated and a stack error is indicated.

• Registers 6 and 7 -Stack Limit Pointer

\

' )

\~

: I

\--..J

These registers contain the 16-bit stack limit pointer (the high-order 8 bits are · in register 6 and the low-order 8 bits are in register 7) that specifies the upper '\_) limit of the stack address space. It is the user's responsibility to define enough

I ,

\_)

display storage space for stack manipulation, including the initial

X'2AFEOOOO'. If the stack current pointer becomes equal to or greater than the stack limit pointer as a result of a push operation, the push operation is not executed; the display program is terminated and a stack error is indicated.

Note: Valid pointer values represent a 16-bit address within the page specified in stack registers 0 and 1, which may be in the range from 0 to 65,534. The

low-order bit of the address is ignored and assumed to be zero.

The conditions under which the stack registers are reset to their default values are:

At power-on, or system and device reset.

By a Begin Order Processing (GBGOP) order.

• By a Start Regeneration Timer ( GSR T) order.

By a Set Buffer Address Register and Start command from the host system.

Note: Resetting the stack registers at GBGOP or GSR T order time effectively disables the stack (that is, no stack is present).

Im Dokument '-Graphics System (Seite 176-180)