Input Functions


ReadChar
It reads a single character from the keyboard and returns the character in the register.

ReadHex
It reads a 32-bit hexadecimal integer from the keyboard and returns the value in .

ReadInt
It reads a 32-bit signed integer from the keyboard and returns the value in .

ReadString
It reads a string from the keyboard, stopping when the user presses the key. Pass the offset of a buffer in and set to the maximum number of characters the user can enter, plus 1 (to save space for the terminating null byte). It returns the count of the number of characters typed by the user in .

Simply Reading in and Writing out by Using
ReadString ReadChar
 INCLUDE Irvine32.inc
 .data
  buffer  BYTE  128 DUP(0)
 .code
 main PROC
  call  Clrscr
  mov   edx, OFFSET buffer
  mov   ecx, SIZEOF buffer
  call  ReadString
  call  Crlf
  call  WriteString
  exit
 main ENDP
 END main

INCLUDE Irvine32.inc 
  NEWLINE =       
    
 .data
  buffer  BYTE  128 DUP(0)
 .code
 main PROC
      call  Clrscr
      mov   esi, (OFFSET buffer) - 1
 L1:  inc   esi
      call  ReadChar
      call  WriteChar
      mov   [esi], al
      cmp   al, NEWLINE
      jne   L1
      mov   BYTE PTR [esi], 0
      call  Crlf
      mov   edx, OFFSET buffer   
      call  WriteString
      exit
 main ENDP
 END main

An Execution Example An Execution Example

   This is only a test. 

  This is only a test.


   This is only a test. 

  This is only a test.


†The white italic text with a navy background color is entered by users.








      “Argued that men cannot be compared to dogs,    
      because dogs are actually loyal.”    
      ― Wanda Sykes