BYTE


SUNDB86x Only

 

The BYTE compiler directive allows the insertion of 8-bit values that represent machine code instructions within PL/B source code. These values perform instructions normally unavailable in PL/B. The instruction uses one of the following formats:

 

(1)

[label]

BYTE

{code}

(2)

[label]

BYTE

{code}:

 

 

 

{code}:

 

 

 

...etc

 

Where:

label

Optional. A Program Execution Label.

code

Required. One or more control literals (binary, decimal, hex, or octal) containing 8 bit absolute machine code, Data Definition Labels, a VARLIST of valid Data Definition Labels that are inserted into the PL/B object code.

Flags Affected: NONE

Note the following:

  1. The value of each item in {code} is not translated but written into the output code exactly as given. This instruction should only be used by programmers knowledgeable in machine language. This is an area where Sunbelt may offer examples but will not provide support, except at prevailing time and material consulting rates.

  2. Multiple {code} items may be placed on a single line and may be continued onto other lines using the colon (:) line continuation technique.

  3. A Data Definition Label may be a {code} item that references a variable. The compiler automatically inserts the address of the variable, in correct byte order, in place of the referenced variable.

  4. Multiple +/- operations may be performed on an address by placing a plus (+) or minus (-) sign and a valid Ctrl literal designating the number of offset bytes immediately following the Data Definition Label.

  5. When referencing variables within {code}, care should be taken not to overwrite the variable designator or Form Pointer/Length Pointer (as appropriate). When a Data Definition Label is used, the memory location referenced is not the first byte of the data for the variable. Therefore, it is necessary to increment this address by one for FORMs or INTEGERs and by two for DIMs or INITs to access the data therein.

  6. Moving data into a DIM/INIT does not automatically adjust the Form Pointer or Length Pointer as if performed through other PL/B instructions. Any data transferred may not be accessible until the Form Pointer and Length Pointer have been adjusted appropriately.

  7. If the DS, ES, SS, or SP registers are modified, they must be saved prior to such modification and restored before executing a PL/B instruction other than BYTE or WORD. The saving and restoration may be accomplished using BYTE/WORD instructions.

 

Example 1:

 

*

 

 

 

.Print the screen on the default printer.

.

 

 

 

  

BYTE

0xCD,0x5

INT 5 ; MS-DOS Print Screen

 

Example 2:

 

*

 

 

.Determine total configured memory in bytes.

.

 

 

TEMP

INTEGER

2

MEMORY

FORM

6

  

BYTE

0x3E,0x8D,0x3E,TEMP+1:

  

  

  0xCD,0x12:

  

  

  0x3E,0x89,0x5

  

MULT

"1024",TEMP,MEMORY

 

 

Example 3:

 

*

 

 

 

.Turn on the NUM Lock on a PC.

.

 

 

 

  

BYTE

0x1E

PUSH DS

  

BYTE

0xB8,0x40,0x0

MOV AX,40H

  

BYTE

0x8E,0xD8

MOV DS,AX

  

BYTE

0x80,0xE,0x17,0x0,0x20

 

.

 

 

OR DS:Byte Ptr[17h],20h

  

BYTE

0x1F

POP DS

 

 

 

See Also: BYTEX, ENTERZ/EXITZ, WORD, WORDX, and Compiler Directives

 



PL/B Language Reference %AUTODIM BYTEX