procedure check_function_keys;
begin
  qkey := readkey;
  case qkey of

 { F1 }                #59      : help;
 { alt F1              #104     : ;                           }
 { shf F               #84      : ;                           }
 { ctl F1              #94      : ;                           }

 { F2     }            #60      : begin
                                    clear_screen;
                                    send_interrupt := TRUE;
                                  end;
 { alt F2              #105     : ;                            }
 { shf F2              #85      : ;                            }
 { ctl F2              #95      : ;                            }

 { F3     }            #61      : clear_transmit_screen;
 { alt F3              #106     : ;                            }
 { shf F3              #86      : ;                            }
 { ctl F3              #96      : ;                            }

 { F4     }            #62      : clear_receive_screen;
 { alt F4              #107     :                              }
 { shf F4              #87      : ;                            }
 { ctl F4              #97      : ;                            }

 { F5     }            #63      : view_modify_msgs;
 { alt F5 }            #108     : load_messages;
 { shf F5 }            #88      : save_messages;
 { ctl F5              #98      : ;                            }

 { F6     }            #64      : begin
                                    rcv_cnt := 0;
                                    FillChar(rcv_buffer,$800,#32);
                                  end;
 { alt F6 }            #109     : save_buffer;
 { shf F6              #89      : ;                            }
 { ctl F6              #99      : ;                            }

 { F7     }            #65      : send_file;
 { alt F7              #110     : ;                           }
 { shf F7              #90      : ;                           }
 { ctl F7              #100     : ;                           }

 { F8     }            #66      : begin
                                    change_speed;
                                    send_interrupt := TRUE;
                                  end;
 { alt F8              #111     : ;                           }
 { shf F8              #91      : ;                           }
 { ctl F8              #101     : ;                           }

 { F9  }               #67      : check_dup;
 { alt F9              #112     : ;                           }
 { shf F9              #92      : ;                           }
 { ctl F9              #102     : ;                           }

 { F10 }               #68      : log_qso;
 { alt F10 }           #113     : update_log;
 { shf F10 }           #93      : view_log ;
 { ctl F10             #103     : ;                           }

 { alt 0 }             #129     : xmt_msg(0);
 { alt 1 }             #120     : xmt_msg(1);
 { alt 2 }             #121     : xmt_msg(2);
 { alt 3 }             #122     : xmt_msg(3);
 { alt 4 }             #123     : xmt_msg(4);
 { alt 5 }             #124     : xmt_msg(5);
 { alt 6 }             #125     : xmt_msg(6);
 { alt 7 }             #126     : xmt_msg(7);
 { alt 8 }             #127     : xmt_msg(8);
 { alt 9 }             #128     : xmt_msg(9);

 { alt A }             #30      : begin
                                    auto_switch := NOT auto_switch;
                                    sho_status;
                                  end;
 { alt B }             #48      : case mode of
                                    CW    : ;
                                    RTTY  : new_rtty_baud;
                                    ASCII : new_rtty_baud;
                                  end;
 { alt C }             #46      : case capture of
                                    FALSE : capture_on;
                                    TRUE  : capture_off;
                                  end;
 { alt D }             #32      : check_dup;
 { alt F }             #33      : send_file;
 { alt H }             #35      : help;
 { alt I }             #23      : case mode of
                                    CW    : ;
                                    RTTY  : flip_invert;
                                    ASCII : flip_invert;
                                  end;
 { alt M }             #50      : begin
                                    update_log;
                                    new_mode;
                                    clear_screen;
                                  end;
 { alt P }             #25      : set_parameters;
 { alt Q }             #16      : qsignals;
 { alt R }             #19      : rst;
 { alt S }             #31      : case mode of
                                    CW     : ;
                                    RTTY   : new_rtty_shift;
                                    ASCII  : new_rtty_shift;
                                  end;
 { alt X }             #45      : exit_request;
 { alt W }             #17      : case mode of
                                    CW     : begin
                                               set_speed;
                                               send_interrupt := TRUE;
                                             end;
                                    RTTY   : ;
                                    ASCII  : ;
                                  end;
 { alt Y }             #21      : case mode of
                                    CW     : ;
                                    RTTY   : RYs;
                                    ASCII  : RYs;
                                  end;

  end;
  rcv_interrupt := TRUE;
end;

procedure chk_kbd;
begin
  if keypressed then
  begin
    qkey := readkey;
    case file_mode of
      true: case qkey of
              ^T : case state of
                     receive       : state := transmit;
                     transmit      : halt_xmt;
                   end;
              ^P : pause_flag := true;
              #0 : qkey := readkey;
            end;
      false: case qkey of
               #0 : check_function_keys;
               #8 : del_char;
               #7,#13,' '..'z' : add_char(qkey);
             end;
    end;
  end;
end;


