' ' ****************************** ' * Keyboard-Encoder for * ' * AVR-Chipbasic2 - Computer * ' * MINI-Keyboard with ATMega8 * ' * R2.1 / 11.07.2020 * ' ****************************** ' * (C) by W.Schmidt/-rttyfan- * ' ****************************** ' '******************************************************************************* 'Changelog: '------------------------------------------------------------------------------- '01.05.2017: R1.0 - First Version SH_R, SH_L and Control on PD.1, PD.5 und PD.6 '17.06.2019: R1.1 - Annotated version with SH_R, SH_L and ' Control on PD.1, PD.5 and PD.6 '18.06.2019: Uncomfortable interim solution: RES-Button on PD.4 assigned with ' function SLOW/FAST (S/F). (Toggle mode with 120ms to 0ms) '20.06.2019: R1.2 - Small changes to the layout (only Key functions) ' F12 = now Shift_LEFT_ESC ' Backspace = now Shift_Space ' Arrow keys now separated (LEFT/UP/RIGHT/DOWN without shift) '------------------------------------------------------------------------------- ' New Version / No hardware change necessary !!! '------------------------------------------------------------------------------- '08.07.2020: R2.0 - New concept via make / break functions and automatic press / ' repeat delays (no more SLOW / FAST button required) '11.07.2020: R2.1 - The former "BREAK" button is now assigned the ' BACKSPACE-function. BREAK must be introduced by CONTR_C. '******************************************************************************* ' $regfile = "m8def.dat" 'Atmega8 - Library $crystal = 2000000 'Internal RC oscillator at 2 MHz $baud = 2400 'baud rate 2400 $hwstack = 32 '32 for hardware stack $swstack = 10 '10 for software stack $framesize = 40 '40 by frame $lib "at_emulator.lib" 'PS2 - Library ' Config Portb = Input 'PB.0 to PB.7 as inputs / key connections Portb = 255 'pullups Config Portc = Output 'PC.0 to PC.7 as outputs / key connections Portc = 255 'pullups Config Pind.6 = Input 'Query SHIFT_Left key Portd.6 = 1 'PD.6 on HI Config Pind.5 = Input 'Query Control key Portd.5 = 1 'PD.5 on HI Config Pind.1 = Input 'Query SHIFT_Right key Portd.1 = 1 'PD.1 on HI ' Enable Interrupts 'Switch on interrupts ' 'PIND.3 - As interrupt INT1 'PIND.7 - Output as PS2-KB_CLOCK 'PIND.3 - Output as PS2-KB_Data 'PS2-Data - Connected to interrupt pin! ' Config Atemu = Int1 , Data = Pind.3 , Clock = Pind.7 ' Dim Press_Delay as Integer Dim Repeat_Delay as Integer Dim Press_Delay_Break as Integer ' Press_Delay = 160 'Normal Delay Repeat_Delay = 30 'Repeat Delay ' do ' '******************************************************************************* Portc = &HF7 '******************************************************************************* '*********************************************************** If Pind.1 = 1 and PIND.5 = 0 and pind.6 = 1 then 'Contr ON '*********************************************************** ' Sendscankbd Key_Contr_Make if PINB = &HFE Then Sendscankbd Key_c_Make 'Contr.C if Pind.5 = 1 then 'Contr OFF Sendscankbd Key_Contr_Break end if end if ' '******************************************************************************* Portc = &HDF '******************************************************************************* ' '*********************************************************** If Pind.1 = 1 and pind.5 = 1 and PIND.6 = 1 then 'Normal '*********************************************************** ' If Pinb = &HFE Then Sendscankbd Key_F4 'F4 waitms Press_Delay end if '----------------------------------------------------------- If Pinb = &HFD Then Sendscankbd Key_F3 'F3 waitms Press_Delay end if '----------------------------------------------------------- If Pinb = &HFB Then Sendscankbd Key_F2 'F2 waitms Press_Delay end if '----------------------------------------------------------- If Pinb = &HF7 Then Sendscankbd Key_F1 'F1 waitms Press_Delay end if '----------------------------------------------------------- If Pinb = &HEF Then Sendscankbd Key_ESC 'Escape waitms Press_Delay waitms Press_Delay end if ' '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_Up_Make 'UP gosub Repeat loop until PINB <> &HDF Sendscankbd Key_Up_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_Right_Make 'Right gosub Repeat loop until PINB <> &HBF Sendscankbd Key_Right_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_Down_Make 'DOWN gosub Repeat loop until PINB <> &H7F Sendscankbd Key_Down_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '*********************************************************** If pind.6 = 0 then 'Shift_L '*********************************************************** ' If Pinb = &HEF Then Sendscankbd Key_F12 'F12 waitms Press_Delay End If ' '*********************************************************** If Pind.1 = 1 and PIND.5 = 0 and pind.6 = 1 then 'Contr ON '*********************************************************** ' Sendscankbd Key_Contr_Make If Pinb = &HFE Then Sendscankbd Key_Con_F4 'CTR_F4 If Pinb = &HFD Then Sendscankbd Key_Con_F3 'CTR_F3 If Pinb = &HFB Then Sendscankbd Key_Con_F2 'CTR_F2 If Pinb = &HF7 Then Sendscankbd Key_Con_F1 'CTR_F1 if Pind.5 = 1 then 'Contr OFF Sendscankbd Key_Contr_Break end if End If ' '******************************************************************************* Portc = &HFE '******************************************************************************* ' '*********************************************************** If PIND.6 = 0 then 'Shift_L '*********************************************************** ' If Pinb = &HFD Then Sendscankbd Key_SHL_Make do Sendscankbd Key_a_Make 'A gosub Repeat loop until PINB <> &HFD Sendscankbd Key_a_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then Sendscankbd Key_SHL_Make do Sendscankbd Key_q_Make 'Q gosub Repeat loop until PINB <> &HFB Sendscankbd Key_q_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_p_Make 'P gosub Repeat loop until PINB <> &HDF Sendscankbd Key_p_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End if ' '*********************************************************** If Pind.1 = 1 and pind.5 = 1 and PIND.6 = 1 then 'Normal '*********************************************************** ' '----------------------------------------------------------- If Pinb = &HFE Then do Sendscankbd Key_BS 'BS gosub Repeat loop until PINB <> &HFE Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_a_Make 'a gosub Repeat loop until PINB <> &HFD Sendscankbd Key_a_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_q_Make 'q gosub Repeat loop until PINB <> &HFB Sendscankbd Key_q_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then do Sendscankbd Key_1_Make '1 gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_1_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then do Sendscankbd Key_0_Make '0 gosub Repeat loop until PINB <> &HEF Sendscankbd Key_0_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_p_Make 'p gosub Repeat loop until PINB <> &HDF Sendscankbd Key_p_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_Left_Make 'Left gosub Repeat loop until PINB <> &HBF Sendscankbd Key_Left_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then Sendscankbd Key_RET 'Return waitms Press_Delay End if '----------------------------------------------------------- end if ' '*********************************************************** If PIND.1 = 0 then 'Shift_R '*********************************************************** ' If Pinb = &HFB Then do Sendscankbd Key_SHR_Q '? gosub Repeat loop until PINB <> &HFB Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then Sendscankbd Key_SHR_Make do Sendscankbd Key_1_Make '! gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_1_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then Sendscankbd Key_SHR_Make do Sendscankbd Key_0_Make '= gosub Repeat loop until PINB <> &HEF Sendscankbd Key_0_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End if ' '******************************************************************************* Portc = &HFD '******************************************************************************* ' '*********************************************************** If PIND.6 = 0 then 'Shift_L '*********************************************************** ' If Pinb = &HFE Then Sendscankbd Key_SHL_Make do Sendscankbd Key_y_Make 'Y gosub Repeat loop until PINB <> &HFE Sendscankbd Key_y_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then Sendscankbd Key_SHL_Make do Sendscankbd Key_s_Make 'S gosub Repeat loop until PINB <> &HFD Sendscankbd Key_s_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then Sendscankbd Key_SHL_Make do Sendscankbd Key_w_Make 'W gosub Repeat loop until PINB <> &HFB Sendscankbd Key_w_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_o_Make 'O gosub Repeat loop until PINB <> &HDF Sendscankbd Key_o_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_l_Make 'L gosub Repeat loop until PINB <> &HBF Sendscankbd Key_l_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '************************************************************ If Pind.1 = 1 and pind.5 = 1 and PIND.6 = 1 then 'Normal '************************************************************ ' If Pinb = &HFE Then do Sendscankbd Key_y_Make 'y gosub Repeat loop until PINB <> &HFE Sendscankbd Key_y_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_s_Make 's gosub Repeat loop until PINB <> &HFD Sendscankbd Key_s_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_w_Make 'w gosub Repeat loop until PINB <> &HFB Sendscankbd Key_w_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then do Sendscankbd Key_2_Make '2 gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_2_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then do Sendscankbd Key_9_Make '9 gosub Repeat loop until PINB <> &HEF Sendscankbd Key_9_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_o_Make 'o gosub Repeat loop until PINB <> &HDF Sendscankbd Key_o_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_l_Make 'l gosub Repeat loop until PINB <> &HBF Sendscankbd Key_l_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_SP 'Space gosub Repeat loop until PINB <> &H7F Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '*********************************************************** If PIND.1 = 0 then 'Shift_R '*********************************************************** ' If Pinb = &HFE Then do Sendscankbd Key_SHR_Y '; gosub Repeat loop until PINB <> &HFE Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_SHR_S 'TAB gosub Repeat loop until PINB <> &HFD Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_SHR_W '` gosub Repeat loop until PINB <> &HFB Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then Sendscankbd Key_SHR_Make do Sendscankbd Key_2_Make '" gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_2_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then Sendscankbd Key_SHR_Make do Sendscankbd Key_9_Make 'Par.) gosub Repeat loop until PINB <> &HEF Sendscankbd Key_9_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_SHR_O '> gosub Repeat loop until PINB <> &HDF Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '******************************************************************************* Portc = &HFB '******************************************************************************* ' '*********************************************************** If PIND.6 = 0 then 'Shift_L '*********************************************************** ' If Pinb = &HFE Then Sendscankbd Key_SHL_Make do Sendscankbd Key_x_Make 'X gosub Repeat loop until PINB <> &HFE Sendscankbd Key_x_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then Sendscankbd Key_SHL_Make do Sendscankbd Key_d_Make 'D gosub Repeat loop until PINB <> &HFD Sendscankbd Key_d_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then Sendscankbd Key_SHL_Make do Sendscankbd Key_e_Make 'E gosub Repeat loop until PINB <> &HFB Sendscankbd Key_e_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_i_Make 'I gosub Repeat loop until PINB <> &HDF Sendscankbd Key_i_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_k_Make 'K gosub Repeat loop until PINB <> &HBF Sendscankbd Key_k_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then Sendscankbd Key_SHL_Make do Sendscankbd Key_m_Make 'M gosub Repeat loop until PINB <> &H7F Sendscankbd Key_m_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '************************************************************ If Pind.1 = 1 and pind.5 = 1 and PIND.6 = 1 then 'Normal '************************************************************ ' If Pinb = &HFE Then do Sendscankbd Key_x_Make 'x gosub Repeat loop until PINB <> &HFE Sendscankbd Key_x_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_d_Make 'd gosub Repeat loop until PINB <> &HFD Sendscankbd Key_d_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_e_Make 'e gosub Repeat loop until PINB <> &HFB Sendscankbd Key_e_Break Press_Delay_Break=0 end if '----------------------------------------------------------- if pinb = &HF7 then do sendscankbd Key_3_Make '3 gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_3_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then do Sendscankbd Key_8_Make '8 gosub Repeat loop until PINB <> &HEF Sendscankbd Key_8_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_i_Make 'i gosub Repeat loop until PINB <> &HDF Sendscankbd Key_i_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_k_Make 'k gosub Repeat loop until PINB <> &HBF Sendscankbd Key_k_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_m_Make 'm gosub Repeat loop until PINB <> &H7F Sendscankbd Key_m_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '*********************************************************** If PIND.1 = 0 then 'Shift_R '*********************************************************** ' If Pinb = &HFE Then do Sendscankbd Key_SHR_X ': gosub Repeat loop until PINB <> &HFE Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_SHR_D 'Ende gosub Repeat loop until PINB <> &HFD Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_SHR_E '* gosub Repeat loop until PINB <> &HFB Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then Sendscankbd Key_SHR_Make do Sendscankbd Key_3_Make '@ gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_3_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then Sendscankbd Key_SHR_Make do Sendscankbd Key_8_Make 'Par.( gosub Repeat loop until PINB <> &HEF Sendscankbd Key_8_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_SHR_I '< gosub Repeat loop until PINB <> &HDF Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_SHR_K 'Einfg gosub Repeat loop until PINB <> &HBF Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_SHR_M '| gosub Repeat loop until PINB <> &H7F Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '******************************************************************************* Portc = &HF7 '******************************************************************************* ' '*********************************************************** If PIND.6 = 0 then 'Shift_L '*********************************************************** ' If Pinb = &HFE Then Sendscankbd Key_SHL_Make do Sendscankbd Key_c_Make 'C gosub Repeat loop until PINB <> &HFE Sendscankbd Key_c_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then Sendscankbd Key_SHL_Make do Sendscankbd Key_f_Make 'F gosub Repeat loop until PINB <> &HFD Sendscankbd Key_f_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then Sendscankbd Key_SHL_Make do Sendscankbd Key_r_Make 'R gosub Repeat loop until PINB <> &HFB Sendscankbd Key_r_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_u_Make 'U gosub Repeat loop until PINB <> &HDF Sendscankbd Key_u_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_j_Make 'J gosub Repeat loop until PINB <> &HBF Sendscankbd Key_j_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then Sendscankbd Key_SHL_Make do Sendscankbd Key_n_Make 'N gosub Repeat loop until PINB <> &H7F Sendscankbd Key_n_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '************************************************************ If Pind.1 = 1 and pind.5 = 1 and PIND.6 = 1 then 'Normal Char '************************************************************ ' If Pinb = &HFE Then do Sendscankbd Key_c_Make 'c gosub Repeat loop until PINB <> &HFE Sendscankbd Key_c_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_f_Make 'f gosub Repeat loop until PINB <> &HFD Sendscankbd Key_f_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_r_Make 'r gosub Repeat loop until PINB <> &HFB Sendscankbd Key_r_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then do Sendscankbd Key_4_Make '4 gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_4_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then do Sendscankbd Key_7_Make '7 gosub Repeat loop until PINB <> &HEF Sendscankbd Key_7_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_u_Make 'u gosub Repeat loop until PINB <> &HDF Sendscankbd Key_u_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_j_Make 'j gosub Repeat loop until PINB <> &HBF Sendscankbd Key_j_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_n_Make 'n gosub Repeat loop until PINB <> &H7F Sendscankbd Key_n_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '*********************************************************** If PIND.1 = 0 then 'Shift_R '*********************************************************** ' If Pinb = &HFE Then do Sendscankbd Key_SHR_C ', gosub Repeat loop until PINB <> &HFE Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_SHR_F 'Pos1 gosub Repeat loop until PINB <> &HFD Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_SHR_R '+ gosub Repeat loop until PINB <> &HFB Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then Sendscankbd Key_SHR_Make do Sendscankbd Key_4_Make '$ gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_4_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then Sendscankbd Key_SHR_Make do Sendscankbd Key_7_Make '/ gosub Repeat loop until PINB <> &HEF Sendscankbd Key_7_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_SHR_U '# gosub Repeat loop until PINB <> &HDF Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_SHR_J 'Entf gosub Repeat loop until PINB <> &HBF Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_SHR_N '_ gosub Repeat loop until PINB <> &H7F Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '******************************************************************************* Portc = &HEF '******************************************************************************* ' '*********************************************************** If PIND.6 = 0 then 'Shift_L '*********************************************************** ' If Pinb = &HFE Then Sendscankbd Key_SHL_Make do Sendscankbd Key_v_Make 'V gosub Repeat loop until PINB <> &HFE Sendscankbd Key_v_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then Sendscankbd Key_SHL_Make do Sendscankbd Key_g_Make 'G gosub Repeat loop until PINB <> &HFD Sendscankbd Key_g_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then Sendscankbd Key_SHL_Make do Sendscankbd Key_t_Make 'T gosub Repeat loop until PINB <> &HFB Sendscankbd Key_t_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_z_Make 'Z gosub Repeat loop until PINB <> &HDF Sendscankbd Key_z_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then Sendscankbd Key_SHL_Make do Sendscankbd Key_h_Make 'H gosub Repeat loop until PINB <> &HBF Sendscankbd Key_h_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then Sendscankbd Key_SHL_Make do Sendscankbd Key_b_Make 'B gosub Repeat loop until PINB <> &H7F Sendscankbd Key_b_Break Sendscankbd Key_SHL_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '************************************************************ If Pind.1 = 1 and pind.5 = 1 and PIND.6 = 1 then 'Normal '************************************************************ ' If Pinb = &HFE Then do Sendscankbd Key_v_Make 'v gosub Repeat loop until PINB <> &HFE Sendscankbd Key_v_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFD Then do Sendscankbd Key_g_Make 'g gosub Repeat loop until PINB <> &HFD Sendscankbd Key_g_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_t_Make 't gosub Repeat loop until PINB <> &HFB Sendscankbd Key_t_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then do Sendscankbd Key_5_Make '5 gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_5_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then do Sendscankbd Key_6_Make '6 gosub Repeat loop until PINB <> &HEF Sendscankbd Key_6_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_z_Make 'z gosub Repeat loop until PINB <> &HDF Sendscankbd Key_z_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HBF Then do Sendscankbd Key_h_Make 'h gosub Repeat loop until PINB <> &HBF Sendscankbd Key_h_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_b_Make 'b gosub Repeat loop until PINB <> &H7F Sendscankbd Key_b_Break Press_Delay_Break=0 end if '----------------------------------------------------------- End If ' '*********************************************************** If PIND.1 = 0 then 'Shift_R '*********************************************************** ' If Pinb = &HFE Then do Sendscankbd Key_SHR_V '. gosub Repeat loop until PINB <> &HFE Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HFB Then do Sendscankbd Key_SHR_T '~ gosub Repeat loop until PINB <> &HFB Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HF7 Then Sendscankbd Key_SHR_Make do Sendscankbd Key_5_Make '% gosub Repeat loop until PINB <> &HF7 Sendscankbd Key_5_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HEF Then Sendscankbd Key_SHR_Make do Sendscankbd Key_6_Make '& gosub Repeat loop until PINB <> &HEF Sendscankbd Key_6_Break Sendscankbd Key_SHR_Break Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &HDF Then do Sendscankbd Key_SHR_Z '\ gosub Repeat loop until PINB <> &HDF Press_Delay_Break=0 end if '----------------------------------------------------------- If Pinb = &H7F Then do Sendscankbd Key_SHR_B '- gosub Repeat loop until PINB <> &H7F Press_Delay_Break=0 end if '----------------------------------------------------------- end if loop ' '******************************************************************************* Repeat: '******************************************************************************* If Press_Delay_Break=1 then waitms Repeat_Delay else waitms Press_Delay Press_Delay_Break=1 end if return ' '******************************************************************************* 'Scancodes '******************************************************************************* ' 'Numbers ON ------------------------------------------------ ' Key_0_Make: '0 Data 1, &H45 Key_1_Make: '1 Data 1, &H16 Key_2_Make: '2 Data 1, &H1E Key_3_Make: '3 Data 1, &H26 Key_4_Make: '4 Data 1, &H25 Key_5_Make: '5 Data 1, &H2E Key_6_Make: '6 Data 1, &H36 Key_7_Make: '7 Data 1, &H3D Key_8_Make: '8 Data 1, &H3E Key_9_Make: '9 Data 1, &H46 ' 'Numbers OFF ----------------------------------------------- ' Key_0_Break: '0 Data 2, &HF0,&H45 Key_1_Break: '1 Data 2, &HF0,&H16 Key_2_Break: '2 Data 2, &HF0,&H1E Key_3_Break: '3 Data 2, &HF0,&H26 Key_4_Break: '4 Data 2, &HF0,&H25 Key_5_Break: '5 Data 2, &HF0,&H2E Key_6_Break: '6 Data 2, &HF0,&H36 Key_7_Break: '7 Data 2, &HF0,&H3D Key_8_Break: '8 Data 2, &HF0,&H3E Key_9_Break: '9 Data 2, &HF0,&H46 ' 'Lowercase Letters ON -------------------------------------- ' Key_a_Make: 'a Data 1, &H1C Key_b_Make: 'b Data 1, &H32 Key_c_Make: 'c Data 1, &H21 Key_d_Make: 'd Data 1, &H23 Key_e_Make: 'e Data 1, &H24 Key_f_Make: 'f Data 1, &H2B Key_g_Make: 'g Data 1, &H34 Key_h_Make: 'h Data 1, &H33 Key_i_Make: 'i Data 1, &H43 Key_j_Make: 'j Data 1, &H3B Key_k_Make: 'k Data 1, &H42 Key_l_Make: 'l Data 1, &H4B Key_m_Make: 'm Data 1, &H3A Key_n_Make: 'n Data 1, &H31 Key_o_Make: 'o Data 1, &H44 Key_p_Make: 'p Data 1, &H4D Key_q_Make: 'q Data 1, &H15 Key_r_Make: 'r Data 1, &H2D Key_s_Make: 's Data 1, &H1B Key_t_Make: 't Data 1, &H2C Key_u_Make: 'u Data 1, &H3C Key_v_Make: 'v Data 1, &H2A Key_w_Make: 'w Data 1, &H1D Key_x_Make: 'x Data 1, &H22 Key_y_Make: 'y Data 1, &H1A Key_z_Make: 'z Data 1, &H35 ' 'Lowercase Letters OFF ------------------------------------- ' Key_a_Break: 'a Data 2, &HF0,&H1C Key_b_Break: 'b Data 2, &HF0,&H32 Key_c_Break: 'c Data 2, &HF0,&H21 Key_d_Break: 'd Data 2, &HF0,&H23 Key_e_Break: 'e Data 2, &HF0,&H24 Key_f_Break: 'f Data 2, &HF0,&H2B Key_g_Break: 'g Data 2, &HF0,&H34 Key_h_Break: 'h Data 2, &HF0,&H33 Key_i_Break: 'i Data 2, &HF0,&H43 Key_j_Break: 'j Data 2, &HF0,&H3B Key_k_Break: 'k Data 2, &HF0,&H42 Key_l_Break: 'l Data 2, &HF0,&H4B Key_m_Break: 'm Data 2, &HF0,&H3A Key_n_Break: 'n Data 2, &HF0,&H31 Key_o_Break: 'o Data 2, &HF0,&H44 Key_p_Break: 'p Data 2, &HF0,&H4D Key_q_Break: 'q Data 2, &HF0,&H15 Key_r_Break: 'r Data 2, &HF0,&H2D Key_s_Break: 's Data 2, &HF0,&H1B Key_t_Break: 't Data 2, &HF0,&H2C Key_u_Break: 'u Data 2, &HF0,&H3C Key_v_Break: 'v Data 2, &HF0,&H2A Key_w_Break: 'w Data 2, &HF0,&H1D Key_x_Break: 'x Data 2, &HF0,&H22 Key_y_Break: 'y Data 2, &HF0,&H1A Key_z_Break: 'z Data 2, &HF0,&H35 ' 'Special Keys ---------------------------------------------- ' Key_SHR_B: '- Data 3, &H4A,&HF0,&H4A Key_SHR_C: ', Data 3, &H41,&HF0,&H41 Key_SHR_D: 'Ende Data 5, &HE0,&H69,&HE0,&HF0,&H69 Key_SHR_E: '* Data 6, &H59,&H5B,&HF0,&H59,&HF0,&H5B Key_SHR_F: 'Pos1 Data 5, &HE0,&H6C,&HE0,&HF0,&H6C Key_SHR_I: '< Data 3, &H61,&HF0,&H61 Key_SHR_J: 'Entf Data 8 ,&H12,&HE0,&H71,&HE0,&HF0,&H71,&HF0,&H12 Key_SHR_K: 'Einfg Data 8, &H12,&HE0,&H70,&HE0,&HF0,&H70,&HF0,&H12 Key_SHR_M: '| Data 8, &HE0,&H11,&H61,&HE0,&HF0,&H11,&HF0,&H61 Key_SHR_N: '_ Data 6, &H59,&H4A,&HF0,&H59,&HF0,&H4A Key_SHR_O: '> Data 6, &H59,&H61,&HF0,&H59,&HF0,&H61 Key_SHR_Q: '? Data 6, &H59,&H4E,&HF0,&H59,&HF0,&H4E Key_SHR_R: '+ Data 3, &H5B,&HF0,&H5B Key_SHR_S: 'TAB Data 3, &H0D,&HF0,&H0D Key_SHR_T: '~ Data 8, &HE0,&H11,&H5B,&HE0,&HF0,&H11,&HF0,&H5B Key_SHR_U: '# Data 3, &H5D,&HF0,&H5D Key_SHR_V: '. Data 3, &H49,&HF0,&H49 Key_SHR_W: ' Data 6, &H59,&H5D,&HF0,&H59,&HF0,&H5D Key_SHR_X: ': Data 6, &H59,&H49,&HF0,&H59,&HF0,&H49 Key_SHR_Y: '; Data 6, &H59,&H41,&HF0,&H59,&HF0,&H41 Key_SHR_Z: '\ Data 8, &HE0,&H11,&H4E,&HE0,&HF0,&H11,&HF0,&H4E ' 'Control Keys ---------------------------------------------- ' Key_SHR_Make: Data 1, &H59 Key_SHR_Break: Data 2, &HF0,&H59 ' Key_SHL_Make: Data 1, &H12 Key_SHL_Break: Data 2, &HF0,&H12 ' Key_Contr_Break: Data 2, &HF0,&H14 Key_Contr_Make: Data 1, &H14 ' Key_Con_C: 'Break Data 6, &H14,&H21,&HF0,&H14,&HF0,&H21 ' Key_Con_F1: 'Contr.F1 Data 6, &H14,&H05,&HF0,&H14,&HF0,&H05 Key_Con_F2: 'Contr.F2 Data 6, &H14,&H06,&HF0,&H14,&HF0,&H06 Key_Con_F3: 'Contr.F3 Data 6, &H14,&H04,&HF0,&H14,&HF0,&H04 Key_Con_F4: 'Contr.F4 Data 6, &H14,&H0C,&HF0,&H14,&HF0,&H0C ' 'Navigation Keys ------------------------------------------- ' Key_Down_Make: 'Down ON Data 2, &HE0,&H72 Key_Right_Make: 'Right ON Data 2, &HE0,&H74 Key_Up_Make: 'Up ON Data 2, &HE0,&H75 Key_Left_Make: 'Left ON Data 2, &HE0,&H6B '----------------------------------------------------------- Key_Down_Break: 'Down OFF Data 3, &HE0,&HF0,&H72 Key_Right_Break: 'Right OFF Data 3, &HE0,&HF0,&H74 Key_Up_Break: 'Up OFF Data 3, &HE0,&HF0,&H75 Key_Left_Break: 'Left OFF Data 3, &HE0,&HF0,&H6B ' 'Operating Keys -------------------------------------------- ' Key_SP: 'Space Data 3, &H29,&HF0,&H29 Key_RET: 'Return Data 3, &H5A,&HF0,&H5A Key_ESC: 'Escape Data 3, &H76,&HF0,&H76 Key_BS: 'Backspace Data 3, &H66,&HF0,&H66 Key_F1: 'F1 Data 3, &H05,&HF0,&H05 Key_F2: 'F2 Data 3, &H06,&HF0,&H06 Key_F3: 'F3 Data 3, &H04,&HF0,&H04 Key_F4: 'F4 Data 3, &H0C,&HF0,&H0C Key_F12: 'F12 Data 3, &H07,&HF0,&H07