On 2017-11-28, Richmond wrote:   
   > I am trying to read a key from the keyboard. I have switched off   
   > canonical mode so it doesn't wait for the return key. But it does not   
   > seem to pick up the key in AX.   
      
   is this on Linux? x86_64?   
      
   Is there any reason you're not using the "syscall" instruction?   
   int 0x80 is deprecated on x86_64.   
      
   ALso on x86_64 the system call numbers are different, I think sys_read   
   is syscall #0   
      
   A great tool for debugging things like this is the "strace" program which   
   will show all system calls and arguments from your program.   
      
   Vince   
      
   >   
   > GCHAR: push rax   
   > push rbx   
   > push rcx   
   > push rdx   
   > mov rsi, charbuffer ; buffer = address to store the bytes read   
   > mov rcx,rsi   
   > mov rdx, 0x4 ; number of bytes to read   
   > (setting this to 1 makes no difference)   
   > mov rax, 0x3 ; number for sys_read   
   > mov rbx, 0x2 ; From stdin   
   > int 0x80   
   > MSPRINT "Byte read is "   
   > MOV AX,[charbuffer]   
   > CALL PWORD   
   > pop rdx   
   > pop rcx   
   > pop rbx   
   > pop rax   
   > RET   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|