WORD Examples


Example 1:

 

*

 

 

 

.Print the screen on the default printer.

.

 

 

 

  

WORD

0x5CD

;INT 5 ;MS-DOS Print Screen

 

In this example, it is better to use BYTE since the bytes must be reversed in order to write them in correct byte order format.

 

Example 2:

 

*

 

 

 

.Determine total configured memory in bytes.

.

 

 

 

TEMP

INTEGER

2

 

MEMORY

FORM

6

 

  

BYTE

0xBF

;MOV DI,OFFSET TEMP+1

  

WORD

TEMP+1

 

  

BYTE

0xCD,0x12

;INT 12

  

BYTE

0xAB

;STOSW

  

MULT

"1024",TEMP,MEMORY

 

 

- Move the address of TEMP's data area (TEMP+1) into DI.

- INT 12 returns number of 1k blocks of configured memory in AX (in INTEGER format).

- MOVe the integer value returned in AX to TEMP (pointed to by DI) with STOSW.

- MULTiply TEMP by "1024" placing the result in MEMORY.

 

Example 3:

 

*

 

 

 

.Turn off the NUM Lock on a PC.

.

 

 

 

  

BYTE

0x1E

;PUSH DS

  

BYTE

0xB8

;MOV AX,40H

  

WORD

0x40

 

  

BYTE

0x8E,0xD8

;MOV DS,AX

  

BYTE

0x80,0x26

;AND DS:Byte Ptr [17H],NOT 20H

  

WORD

0x17

 

  

BYTE

0xDF

 

  

BYTE

0x1F

;POP DS

 

- Save contents of DS register.

- Load the AX register with next 2 bytes (0x40).

- Move the contents of AX into DS.

- Bitwise AND a byte value (the NOT value of 20H - 0xDF) into an address (0x17).

- Restore contents of DS register

 

 



PL/B Language Reference WINAPI Examples WRITAB Example