title: How do i check if the arrow keys are pressed in assembly 16 Bits bare bones
body: <p>I try to check if the arrow keys are pressed and i started with the up key but</p>
  
  <pre><code>cmp al, 48h ;if you press the up arrow
  je  .up_pressed
  </code></pre>
  
  <p>nor</p>
  
  <pre><code>cmp al, 48  ;if you press the up arrow
  je  .up_pressed
  </code></pre>
  
  <p>work, it is or 8 or none, and i cant find anything that works for me! does anyone know what the correct code is? it can be hexadecimal ascii or binary. (i need the left, right, down &amp; up keys)</p>
  
  <p>but these DO work:</p>
  
  <pre><code>cmp al, 13  ;if you press enter
  je  .done
  
  cmp al, 8       ;if you press backspace
  je  .backspace
  </code></pre>
  
  <p>i do not get input via:</p>
  
  <pre><code>mov ah, 00h
  int 16h
  </code></pre>
  
  <p>but:</p>
  
  <pre><code>cmd:
  call newline
  mov si, prompt
  call    Print
  mov di, input_buffer
  mov al, 0
  mov cx, 256
  rep stosb
  mov ax, input_buffer
  mov di, input_buffer
  ;check for characters typed
  .loop:
  call    keyboard
  
  cmp al, 13  ;if you press enter
  je  .done
  
  cmp al, 8       ;if you press backspace
  je  .backspace
  
  cmp al, 27  ;if you press ESC
  je  .escape_pressed
  
  cmp al, 48h ;if you press the up arrow
  je  .up_pressed
  
  jmp .character  ;otherwise just register a character
  
  .up_pressed:
  call newline
  mov si, debug
  call Print
  jmp cmd
  
  .backspace:     ;remove a character
  mov ah, 0Eh
  mov al, 8
  int 10h
  mov al, 32
  int 10h
  mov al, 8
  int 10h
  dec di
  jmp .loop
  
  .escape_pressed:
  call newline
  mov si, escape_pressed_message
  call Print
  jmp cmd
  
  .character:     ;register a character
  mov ah, 0Eh
  int 10h
  stosb
  jmp .loop
  
  .done:          ;start comparing input&lt;-&gt;commands
  mov ax, 0
  stosb
  
  call    newline ;but first make a new line
  
  mov si, input_buffer
  cmp BYTE [si], 0
  
  je  cmd
  </code></pre>
  
  <p>there is a call to keyboard so here the keyboard code:</p>
  
  <pre><code>keyboard:
         pusha
         mov  ax, 0
         mov  ah, 10h
         int  16h
         mov  [.buffer], ax
         popa
         mov  ax, [.buffer]
         ret
  
         .buffer  dw  0
  </code></pre>