📄 key.med
字号:
891 ;V4.11 inc (BLK_CT)
892 ;V4.11 ld a,(BLK_CT)
893 ;V4.11 and a,0x7f
894 ;V4.11 cmp a,0x40
895 ;V4.11 j ge,blink_vfd_on
896 ;V4.11 @CLB (F_BLINK) ;V2.10
897 ;V4.11 jp blink_vfd_end ;V2.10
898 blink_vfd_on:
899 ;V4.11 @SEB (F_BLINK) ;V2.10
900 blink_vfd_end:
901 ;V4.11 call disp_to_dbr ;V2.10
902 ;V4.11 ret ;V2.10
903 blink_vfd_off: ;V2.10
904 ;V4.11 call vft_disable ;V2.10
905 ;V4.11 @CLB (F_BLINK) ;V2.10
906 ret ;V2.10
907 ;------------------------------------V2.05
908 wait_100ms:
909 ld (DELAY_CT),125 ;800usx125 -> 100ms
910 j wait_xms
911 wait_50ms:
912 ld (DELAY_CT),62 ;800usx62-> 49.6ms
913 wait_xms:
914 cmp (DELAY_CT),0
915 j ne,wait_xms
916 ret
917 ;==============================================================================
918 ; Key scan interrupt
919 ;==============================================================================
920 ;V1.39aKON_TIM equ 2 ;judgement for key press (800us*12scan*2=19.2ms to 19.2ms+800*11scan=28ms)
921 ;V1.34KOFF_TIM equ 4 ;judgement for key release (800us*12scan*4=38.4ms to 38.4ms+800*11scan=47.2ms)
922 ;V1.39aKOFF_TIM equ 2
923 KON_TIM equ 1 ;V1.39a
924 KOFF_TIM equ 3 ;V1.39a
925 MD_TIM equ 15 ;judgement for mode sw moved (800us*12scan*15=144ms)
926 ;MD_TIM equ 10 ;judgement for mode sw moved (392us*12scan*10=47.040ms)
927
928 key_scan:
930 +1 push wa
931 +1 push bc
932 +1 push de
933 +1 push hl
934 +1 push ix
935 +1 push iy
936 cmp (DELAY_CT),0
937 j eq,check_delay_time
938 dec (DELAY_CT)
939 check_delay_time:
941 +1 ld wa,IO_MT
942 +1 test (IO_MT>>4).a ;bit -reverse-> jump status
943 +1 j t,key_scan00 ;if jump status is 1 -> branch
944 ;V3.00 @RST_IN_ON(key_scan99) ;when print reset sign checked in, jump out
945 ;V3.12 ei ;V3.00
946 key_scan00:
947 ld a,(EP_TIM) ;\
948 j z,key_scan_01 ;|during EEPROM reading and writing, skip to key scan end
949 dec (EP_TIM) ;|
950 jp key_scan99 ;/
951 key_scan_01:
953 +1 ld wa,EP_ACCES
954 +1 test (EP_ACCES>>4).a ;bit -reverse-> jump status
955 +1 j f,key_scan99 ;if jump status is 0 -> branch
956 ;V2.13 call feed_check
958 +1 ld wa,F_KON
959 +1 test (F_KON>>4).a ;bit -reverse-> jump status
960 +1 j f,key_scan_02 ;if jump status is 0 -> branch
961 ;V1.39key_scan_01x:
962 call mdsw_scan
963 call update_mdsw ;for remove mode sw chattaring
964 key_scan_02:
965 ;V4.11 @BBS (SW_OFF_RT,key_scan90) ;power sw move to OFF mode? yes -> exit
966 ;V4.11 @BBS (F_OFF,key_scan90) ;if OFF mode? yes -> exit
968 +1 ld wa,IO_MT
969 +1 test (IO_MT>>4).a ;bit -reverse-> jump status
970 +1 j f,key_scan_03 ;if jump status is 0 -> branch
972 +1 ld wa,F_DOFF
973 +1 test (F_DOFF>>4).a ;bit -reverse-> jump status
974 +1 j f,key_scan_03 ;if jump status is 0 -> branch
975 cmp (OFF_CT),0
976 j eq,key_scan_030
977 dec (OFF_CT)
978 jp key_scan_03
979 key_scan_030:
980 call vft_enable
981 key_scan_03:
982 ld b,(P1PRD)
984 +1 ld wa,F_KON
985 +1 test (F_KON>>4).a ;bit -reverse-> jump status
986 +1 j f,key_scan20 ;if jump status is 0 -> branch
987 and b,0y00111111 ;
988 j z,key_scan90 ;no key press yes->
989
990 ;Detect key press...............................
991 ld c,0xff;V1.01
992 ;V3.00 swap b
993 ;--------------------------------------------------------------
994 key_scan12:;V1.01
995 ;V3.00 shlc b ;shift current key return
996 shrc b
997 inc c ;count which bit is high in register b
998 j cc,key_scan12
999 ;--------------------------------------------------------------
1000 ld hl,tbl_rtndt ;\
1001 ld b,(hl+c) ;|key return (matrix vertical)-->RET_BK
1002 ld (RET_BK),b ;/
1003 ld a,(SCAN_CT) ;\
1004 ld (SCAN_BK),a ;/key scan (matrix horizontal)-->SCAN_BK
1005 ld (KI_CT),KON_TIM
1007 +1 ld wa,F_KON
1008 +1 set (F_KON>>4).a
1009 ld (BLK_CT),0
1010 j key_scan90
1011
1012 ;Key on check...................................
1013 key_scan20:
1014 ld a,(SCAN_CT) ;whether the same key keep in pressing
1015 cmp a,(SCAN_BK) ;//
1016 j ne,key_scan90 ;/different scan line? yes-> exit
1018 +1 ld wa,F_KOFF
1019 +1 test (F_KOFF>>4).a ;bit -reverse-> jump status
1020 +1 j f,key_scan30 ;if jump status is 0 -> branch
1021 and b,0y00111111 ;reg.b = current key return
1022 j z,key_scan32 ;for make sure
1023 and b,(RET_BK) ;previous key on continue?
1024 j z,key_scan32 ;If chataling? yes->
1025 dec (KI_CT)
1026 j nz,key_scan90
1027 ld (KI_CT),KOFF_TIM ;detect key on?
1029 +1 ld wa,F_KOFF
1030 +1 set (F_KOFF>>4).a
1031
1032 ;Key code calculation...........................
1033 ld c,0xff
1034 key_scan22:
1035 shrc b ;shift current key return
1036 inc c ;reg.c = lower 2bit of key code
1037 j cc,key_scan22
1038 ld a,(SCAN_CT)
1039 ;V3.00 shlc a ;--ax4
1040 ;V3.00 shlc a ;/
1041 ;V3.00 or a,c ;reg.a = key code
1042 ld w,6 ;V3.00
1043 mul w,a ;V3.00
1044 clr cf ;V3.00
1045 add a,c ;V3.00
1046 ld c,a
1047 ld hl,key_conver_tbl
1048 ld a,(hl+c)
1049 cmp (KEY_CT),64 ;\
1050 j ge,key_scan32 ;/key buffer over flow?
1051 ld c,(KEY_WPTR)
1052 and c,0x3f
1053 ld hl,KEY_BUF ;key buffer first address-->hl
1054 ld (hl+c),a ;store key code to KEY_BUF
1055 inc c
1056 and c,0x3f
1057 ld (KEY_WPTR),c
1058 inc (KEY_CT)
1059 j key_scan90
1060
1061 ;Key off check..................................
1062 key_scan30:
1063 ;---------------------------------------------------
1064 and b,0y00111111 ;reg.b = current key return
1065 and b,(RET_BK) ;previous key on continue?
1066 j z,key_scan_h9 ; key released ->
1067 ;-------------------------------------
1068 ;V3.00 @BBC (RTC_ON,key_scan_set0) ;V1.23
1069 ;V3.00 cmp b,RET_SET
1070 ;V3.00 j eq,key_scan_h1
1071 ;V3.00key_scan_set0: ;V1.23
1072 ;V3.00 @BBS (RTC_ON,key_scan90) ;V1.44
1073 ;V3.00 @BBC (SW_V15,key_scan_set1) ;V1.23
1074 ;V3.00 cmp b,RET_IC ;V1.23
1075 ;V3.00 j eq,key_scan_h2 ;V1.23
1076 ;V3.00key_scan_set1: ;V1.23
1077 ;V3.00 ;--------------------------
1078 ;V3.00 @BBS (ICON_E,key_scan90) ;V1.08
1079
1080 ;V1.04 @BBS (F_RATE,key_scan90) ;is RATE key holded?
1081 ;V3.00 @BBS (RATE_PROG,key_scan90) ;already enter into rate setting mode?
1082 ;V3.00 @BBS (IC_PROG,key_scan90) ;V1.44
1083 ;V3.00key_scan_set1y: ;V1.28
1084 ;V3.00 cmp b,RET_RATE ;is rate key?
1085 ;V3.00key_scan_set1z:
1086 ;V3.00 j ne,key_scan90 ;yes-->
1087 ;V3.00 cmp (SCAN_CT),SCAN_RATE
1088 ;V3.00key_scan_set1f:
1089 ;V3.00 j ne,key_scan90
1090 ;V3.00 dec (DW_CT)
1091 ;V3.00 j ne,key_scan90
1092 ;V3.00 @SEB (RATE_PROG) ;enter into rate setting mode
1093 ;V3.00 j key_scan90
1094 ;--------------------------------
1095 ;V3.00key_scan_h0:
1096 ;V3.00 cmp (SCAN_CT),SCAN_FEED
1097 ;V3.00 j ne,key_scan90
1098 ;V3.00 @SEB (F_HLD_FED)
1099 ;V3.00 j key_scan90
1100 ;--------------------------------
1101 ;V3.00key_scan_h1:
1102 ;V3.00 @BBC (RTC_ON,key_scan90) ;V1.18
1103 ;V3.00 cmp (SCAN_CT),SCAN_SET ;V1.18
1104 ;V3.00 j ne,key_scan90 ;V1.18
1105 ;V3.00 @SEB (F_HLD_SET) ;V1.18
1106 ;V3.00 dec (DW_CT) ;V1.18
1107 ;V3.00 j key_scan90 ;V1.18
1108 ;--------------------------------
1109 ;V3.00key_scan_h2: ;V1.23
1110 ;V3.00 @BBS (F_ICDSP,key_scan_h2x) ;V1.23
1111 ;V3.00 jp key_scan90 ;V1.23
1112 ;V3.00key_scan_h2x: ;V1.23
1113 ;V3.00 cmp (SCAN_CT),SCAN_IC ;V1.23
1114 ;V3.00 j ne,key_scan90 ;V1.23
1115 ;V3.00 @SEB (F_HLD_SET) ;V1.23
1116 ;V3.00 dec (DW_CT) ;V1.23
1117 ;V3.00 j ne,key_scan90 ;V1.23
1118 ;V3.00 @SEB (IC_PROG) ;V1.23
1119 j key_scan90 ;V1.23
1120 ;--------------------------------
1121 key_scan_h9:
1122 ;V1.04 @CLB (RATE_PROG) ;for rate set
1123 ;V3.00 @CLB (F_HLD_FED) ;for feed key
1124 ;V3.00 @CLB (F_HLD_SET) ;for time set
1125 dec (KI_CT)
1126 j nz,key_scan90
1127 ;Key check end.................................
1128 key_scan32:
1130 +1 ld wa,F_KOFF
1131 +1 clr (F_KOFF>>4).a
1133 +1 ld wa,F_KON
1134 +1 clr (F_KON>>4).a
1135 ld (DW_CT),0 ;V1.23
1136 ;Output next scan signal.......................
1137 key_scan90:
1138 ld c,(SCAN_CT)
1139 inc c
1140 cmp c,8
1141 j lt,key_scan92
1142 call blink_vfd ;V2.05
1143 key_scan91: ;V1.04
1144 ld c,0
1145 key_scan92:
1146 ld (SCAN_CT),c
1147 ld hl,tbl_scan
1148 ld a,(hl+c)
1149 ld (P9DR),a
1150 key_scan99:
1152 +1 pop iy
1153 +1 pop ix
1154 +1 pop hl
1155 +1 pop de
1156 +1 pop bc
1157 +1 pop wa
1158 reti
1159
1160 tbl_rtndt:
1161 ; db 0y00000001
1162 ; db 0y00000010
1163 ; db 0y00000100
1164 ; db 0y00001000
1165 ; db 0y00010000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -