You are here : assembly8086 INT 21HAH40H

AH=40H - 8086 INT 21H

AH=40h - "WRITE" - WRITE TO FILE OR DEVICE

Entry:

  • BX = file handle
  • CX = number of bytes to write
  • DS:DX -> data to write

Return:

  • CF clear if successful -AX = number of bytes actually written
  • CF set on error - AX = error code (05h,06h)

Notes:

  • if CX is zero, no data is written, and the file is truncated or extended to the current position
  • data is written beginning at the current file position, and the file position is updated after a successful write
  • the usual cause for AX < CX on return is a full disk


Syntax

MOV AH,40H
INT 21H


Example

MOV AH,40H
INT 21H


Output / Return Value

Return:
    CF clear if successful -AX = number of bytes actually written
    CF set on error - AX = error code (05h,06h)


Limitations


Alternatives / See Also


Reference