From: Melzzzzz@nospicedham.zzzzz.com   
      
   On 2017-11-28, vince@nospicedham.pianoman.cluster.toy wrote:   
   > 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.   
      
   Yeah, I just noticed he uses 32 bit calling convention for syscalls ;)   
   params go   
   rdi   
   rsi   
   rdx   
   r10   
   r8   
   r9   
   rax=syscall number   
   and syscall instruction instead of int 080h   
   but his problem is wrong number for stdin if all else works ;p   
      
   >   
   > 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   
      
      
   --   
   press any key to continue or any other to quit...   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|