title: mov ah,01h int16h, how to use it to change the direction of the snake
body: <pre>
  .model small
  .data
  var db  '@', '$'
  
  delaytime db 10
  total db 0
  col db 40
  row db 12
  .stack 100h
  .code
  delay proc
      mov ah, 00
      int 1Ah
      mov bx, dx
  
  jmp_delay:
      int 1Ah
      sub dx, bx
      cmp dl, delaytime
      jl jmp_delay
      ret
  
  delay endp
  
  lefty proc
  dec col
  cmp col, 0
  jle sn
  
  leftyie:
  mov dl , col
  mov dh , row
  xor bh, bh
  mov ah, 02h
  int 10h
  ret 
  
  sn:
  mov col, 79
  jmp leftyie
  lefty endp
  
  
  
  righty proc
  inc col
  cmp col,79
  jg zero
  
  rightyie:
  mov dl,col
  mov dh,row
  xor bh, bh
  mov ah, 02h
  int 10h
  ret 
  
  zero: 
  mov col,0
  jmp rightyie
  righty endp
  
  
  
  upy proc
  dec row
  cmp row, 0
  jl upzero
  
  uptie:
  mov dl,col
  mov dh,row
  xor bh, bh
  mov ah, 02h
  ret
  
  upzero:
  mov row,24
  jmp uptie
  
  upy endp
  
  
  downy proc
  inc row
  cmp row, 24
  jg gozero
  
  downty: 
  mov dl,col
  mov dh,row
  xor bh, bh
   mov ah, 02h
  int 10h
  ret 
  
  gozero:
  mov row,0
  jmp downty
  downy endp
  
  video proc
  mov al, 03h ;set video mode
    mov ah, 00h
    int 10h
    ret
   video endp
  
  start proc
       ;starting coordinates
     mov dh, 12 ;row
     mov dl, 40 ;column
     xor bh, bh
     mov ah, 02h
     int 10h 
     ret
  start endp
  
  dashclear proc
  mov ax, 0600h
  mov bh, 07h
  xor cx, cx
  mov dx, 184fh
  int 10h
  ret
  dashclear endp
  
  getchar proc
  mov ah, 00h
  int 16h
  ret
  getchar endp
  
  
  main  proc
  mov ax, @data
  mov ds, ax
  
  
   call video
   call start
     mov dx, offset var
     mov ah, 09h
         int 21h
  
  
   mov cx, 3200h  ;stop cursor blinking
   mov ah, 01h
   int 10h
  
  call start
  getinput:
  
  call getchar ;get character
  
  
  direct_change:
  cmp ah, 72
  je w 
  cmp ah, 80
  je s 
  cmp ah, 75
  je a 
  cmp ah, 77
  je d
  
  cmp al, 119
  je w 
  cmp al, 115
  je s 
  cmp al, 97
  je a 
  cmp al, 100
  je d
  
  cmp al, 119
  jne rak 
  cmp al, 115
  jne rak
  cmp al, 97
  jne rak 
  cmp al, 100
  jne rak
  
  
  a:
  call delay
  call dashclear
  call lefty
  mov dx, offset var
  mov ah, 09h
  int 21h
  
  
  
  jmp a
  
  
  s:
  call delay
  call dashclear
  call downy
  mov dx, offset var
  mov ah, 09h
  int 21h
  
  jmp s
  
  
  d:
  call delay
  call dashclear
  
  call righty
  mov dx, offset var
  mov ah, 09h
  int 21h
  
  jmp d
  
  
  w:
  call delay
  call dashclear
  
  call upy
  int 10h
  mov dx, offset var
  mov ah, 09h
  int 21h
  
  jmp w
  
  rak:
  jmp getinput
  
  main endp
  end main
  </pre>
  
  <p>i have this code that moves a single character using w,a,s,d how do i use mov ah,01h int16h so that i can move the character while the character moves on its own if i dont press any key to change its direction.</p>
  
  <p>i was thinking that there should be a timer where when the timer ends amd the user did not press anything the character should keep on going to the direction where the last key was pressed then if the user pressed any the control buttons it should change direction</p>