⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp200.asm

📁 合泰MCU写的电话机源程序
💻 ASM
📖 第 1 页 / 共 5 页
字号:
	nop
	nop
	call	F_key_Scan_in_setting
	mov		a,R_key_value
	xor		a,D_star_key
	sz		acc
;	call	F_key_process
	jmp		L_donotturnoff
	sz		flag_power
	jmp		start

	;//// enter normal mode from green mode
L_donotturnoff:

L_Not_sleep:		
	call	F_turn_on_3_58MHz
;	call	F_turn_on_real_time

	sz		R_Key_Hold    ;test key 
	jmp		L_Main_Loop   
	call	F_Stop_Dial
	jmp		L_Main_Loop

;;----------------------------------------------------------------
L_Main_exit:             ;come back from key process routine 
	clr		R_key_value  ;clear key value 
;	clr		pbc.7
	ret

L_main_exit_set:
	clr		R_key_value  ;clear key value 
	clr		flag_set_exit
	clr		flag_store
	ret
;;----------------------------------------------------------------
;		Function: write setting data to eeprom 
;;----------------------------------------------------------------
F_writ_setting_data:
	 mov	a,offset R_pause_time
	 mov	mp0,a
	 mov	a,0edh
	 mov	R_WR_EE_address,a
	 mov	a,0a0h
	 mov	R_EE_bank,a
	 mov	a,6     ;19
	 mov	R_EE_Byte_count,a	
	 call	F_Write_EE_Byte	 
	 ret
;;----------------------------------------------------------------
;		Function: Read setting data from eeprom 
;;----------------------------------------------------------------
F_Read_setting_data:
	 mov	a,offset R_pause_time
	 mov	mp0,a
	 mov	a,0edh
	 mov	R_WR_EE_address,a
	 mov	a,0a0h
	 mov	R_EE_bank,a
	 mov	a,6     ;19
	 mov	R_EE_Byte_count,a	
	 call	F_Read_EE_Byte	 
	 Ret

F_key_process:
	SZ		R_Key_Value      ;test key value ,if equal zero
	JMP		L_Process_Key	 ;not key active ,otherwise jump to process key 
	ret

;;----------------------------------------------------------------
;       ///   key process ///
;;----------------------------------------------------------------
L_Process_Key:
	mov		a,R_key_value
	xor		a,D_store_key
	sz		acc
	jmp		jkljkasdfasdfa
	jmp		adfadfeeere
jkljkasdfasdfa:
   	snz		Flag_store
	jmp		L_mute00
	jmp		adfadfeeere  ;L_not_mute
L_mute00:

;	snz		dialerio.4          ;test hook switch
;	clr		[16h].7           ;XMute pin =0 

adfadfeeere:
	nop
;	sz		Flag_phone_use     ;=1  phone is using
;	jmp		L_phone_is_using_can_process_key

	mov		a,R_Key_Value
	xor		a,D_headset_key
	sz		acc
	jmp		L_not_headsetkeyfuck
	jmp		L_phone_is_using_can_process_key	

L_not_headsetkeyfuck:
;	set		pdc.2           ;set pd.2 as input
;	call	nop4t			;wait port stable 
;	snz		pd.2            ;have power=H
;	jmp		L_no_power_not_detecthold

;	set		pbc.7
;	call	nop4t
;	snz		pb.7
;	clr		flag_line_hold
;	clr		pbc.7               ;10/14 as output mode
;	nop
;	nop
L_no_power_not_detecthold:
	set		pbc.7
	call	nop4t
	snz		pb.7
	jmp		L_Main_exit        ;phone not use exit key process
;	clr		pbc.7

;	set		[16h].5             ;on po  fuck fuck 
	
;	sz		flag_line_hold
;	jmp		L_Main_exit        ;phone not use exit key process

L_phone_is_using_can_process_key:

;	mov		a,R_key_value   ;debug use
;	nop
;	nop

	mov		a,31                
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_Functionkey

	;/// key value <=31
;    sz		flag_save_over32 
;	jmp		L_Main_exit_fuckfuck     ;exit
	
	mov		a,12
	sub		a,R_Key_Value
	snz		c
	jmp		L_Test_P_F_D           		
     ;/// key value <=12 

	set		flag_first_memory    ;25/25 pm.

	sz		flag_flash            ;;debug 9/11 pm.
	clr		R_dial_code_buffer
	clr		flag_flash
	clr		flag_disc	

   	sz		Flag_store
	jmp		L_is_in_store_operating
    ;/// not in store exit

	sz		Flag_phone_use            ;test phone using?
;;	sz		[16h].5
	jmp		L_is_using_can_dial       ;po on can dial
	;/// phone not use 	
	
	snz		pd.2            ;have power=H
	jmp		L_Main_exit
	                        ;no power exit 
	mov		a,R_key_value
	xor		a,0ah
	sz		acc
	jmp		L_Main_exit            ;is not * key exit
	mov		a,2
	mov	    R_Hold_time,a

L_waiting2S_fff:
;	call	F_active_ring
	snz		pb.6                 ;if ringing exit
	jmp		L_Main_exit
	call	F_key_scan              
	sz		R_key_hold
	jmp		L_check_time
	jmp		L_Main_exit
L_check_time:	
	sz		R_Hold_time
	jmp		L_waiting2S_fff

    sz		Flag_message
	jmp		L_clr_message_flag
	set		Flag_message
	jmp		L_exit_setting
L_clr_message_flag:
	clr		Flag_message
L_exit_setting:
	call	F_turn_on_time1	 
	jmp		L_Main_exit               ;po off not dial exit
L_is_using_can_dial:
	sz		Flag_first_dial
	jmp		L_not_first_dial
	jmp		L_first_time_dial_after_offhook
L_not_first_dial:
	;/// the flag=1 not first time dial 
;;/ debug debug
	sz		flag_save_over32   ;????
	jmp		L_can_dial_fff_bufer

	inc		R_dial_code_buffer      ;inc dial count		
	mov		a,96   ;32
	sub		a,R_dial_code_buffer
	snz		c
	jmp		L_save_over32               		
	;///  dial count <= 32	


L_however_cansave:
	mov		a,R_dial_code_buffer     ;
	mov		tblp,a
	tabrdl	acc
	mov		R_temp1,a
	mov		a, offset R_dial_code_buffer+1
	add		a, R_temp1
	mov		mp0,a
	sz		R_dial_code_buffer.0  ;0-->L, 1-->H
	
	jmp		L_store_in_high_nibble_dial
	jmp		L_store_in_Low_nibble_dial

L_Main_exit_fuckfuck:
	jmp		L_Main_exit

	;/// store in high nibble
L_store_in_high_nibble_dial:
	mov		a,R_Key_Value
	swap    acc
	mov		[00h],a
	jmp		L_backup_save_dial_count
L_store_in_Low_nibble_dial:
	mov		a,[00h]
	or		a,R_key_value
	mov		[00h],a
L_backup_save_dial_count:
    snz		flag_dial_pause     ;in between dial pause 
	jmp		L_can_dial_fff
	call	F_set_sound_P       ;when enter number code clear the flag
	jmp		L_Main_exit         ;only can save
L_can_dial_fff:
	call	F_Dial_code         ;can not dial code !
	clr		R_key_value        ;10/14

	sz		flag_save_over32
	clr		R_dial_code_buffer      ;over 32 not save
		
	jmp		L_Main_exit         ;only can save
L_can_dial_fff_bufer:
	jmp      L_can_dial_fff		


L_set_over32_flag:      ;jia jia
	set		flag_save_over32
	jmp		L_however_cansave
L_save_over32:
	sz		flag_dial_pause
	jmp		L_however_cansave      ;11/4 pm.

	dec		R_dial_code_buffer
	;/// fail sound	
	set		flag_save_over32
    snz		flag_dial_pause     ;in between dial pause 
	jmp		L_can_dial_jjj
	call	F_set_sound_P       ;when enter number code clear the flag
	mov		a,  D_pause
	xor		a,R_key_value
	sz		acc
	jmp		L_Main_exit_buk         ;only can save
	jmp		L_however_cansave      ;11/4 pm.

	jmp		L_Main_exit         ;only can save
L_Main_exit_buk:
	jmp		L_however_cansave      ;11/4 pm.


L_can_dial_jjj:
	call	F_Dial_code         ;can not dial code !
	jmp		L_however_cansave      ;11/4 pm.

	clr		R_dial_code_buffer  ;11/4 pm.w
	clr		flag_save_over32
	jmp		L_Main_exit         ;only can save

L_first_time_dial_after_offhook:
	sz		flag_save_over32
	jmp		L_qiweiewi_b
	set		Flag_first_dial          ;set the first time dial flag
	mov		a,1
	mov		R_dial_code_buffer,a     ;initialization dial count
	mov		a,offset R_dial_code_buffer+1
	mov		mp0,a
	mov		a,R_Key_value
	swap	acc
	mov		[00h],a          ;save the first code in high nibble
L_qiweiewi:
    snz		flag_dial_pause     ;in between dial pause 
	call	F_Dial_code         ;can not dial code !
	jmp		L_Main_exit         ;only can save


L_qiweiewi_b:
	jmp		L_qiweiewi
;////////////////////////////

L_is_in_store_operating:
	inc		R_store_code     ;count the store code number

	mov		a,32
	sub		a,R_store_code
	snz		c
	jmp		L_store_large32               		
	;///  store count <= 31	

	mov		a,R_store_code     ;
	mov		tblp,a
	tabrdl	acc
	mov		R_temp1,a
	mov		a, offset R_store_code+1
	add		a, R_temp1
	mov		mp0,a
	
	sz		R_store_code.0  ;0-->L, 1-->H
	
	jmp		L_store_in_high_nibble
	jmp		L_store_in_Low_nibble
L_store_in_high_nibble:
	;/// store in high nibble
	mov		a,R_key_value
	swap	acc           ;	R_Key_Value
	nop
	nop
	mov		[00h],a
	jmp		L_backup_save_store_count
L_store_in_Low_nibble:
	mov		a,[00h]
	or		a,R_key_value
	mov		[00h],a
L_backup_save_store_count:

	call	F_set_sound
	jmp		L_Main_exit

;//////////

L_store_large32:
	;/// fail sound	         ;store number large then 32

	set		Flag_store_over
	call		F_fail_sound

	jmp		L_Main_exit
;;----------------------------------------------------------------
L_Test_P_F_D:
	mov		a,15
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_Memorykey		


	;;////  value 13,14,15 is pause,Flash,Disc key

	sz		Flag_phone_use        ;test phone using?
	jmp		L_is_using_can_dial_1 ;po on can dial

	snz		flag_store
	jmp		L_Main_exit           ;not in using exit

L_is_using_can_dial_1:
	mov		a,14
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_15		
	;/// <=14

	mov		a,13
	sub		a,R_Key_Value
	snz		c
	jmp		L_is_14		
	;/// <=13 ,                     ;pause key

	sz		flag_save_over32
	jmp		L_dial_pause_over32  ;L_Main_exit             ;9/11 debug add 

	sz		flag_store               ;is in store mode?
	jmp		L_is_in_store_operating		
;// 10/9 skip the next 
	sz		Flag_first_dial          ;is the first time dial
	jmp		L_dial_pause             ;not first time dial 
    clr		R_dial_code_buffer   ;2003/1/11 add
	jmp		L_dial_pause         ;2003/1/11 add     
	;//// first time dial ,test dial count=0 cannot dial
L_38key:  ;//10/9 add	
	snz		flag_flash
	jmp		L_abcd
    clr		R_dial_code_buffer   ;2003/1/11 add
	jmp		L_dial_pause         ;2003/1/11 add     
L_38key_11:                      ;2003/1/11 add
	mov		a,32
	sub		a,R_dial_code_buffer
	snz		c
	jmp		L_fail_sound_next               		

	;///  dial count <= 32	

	call	F_redial	
	clr		flag_flash
	set		Flag_first_dial
	jmp		L_Main_exit
L_abcd:
	sz		Flag_first_dial          ;is the first time dial
	jmp		L_Main_exit          ;not first time dial

	         
	sz		R_dial_code_buffer       ;
	jmp		L_code_count_not_equal_0_redial
	;//// code count=0 ,can not redial !!!
L_fail_sound_next:
	call	F_fail_sound
	jmp		L_Main_exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
L_code_count_not_equal_0_redial:

	mov		a,32
	sub		a,R_dial_code_buffer
	snz		c
	jmp		L_fail_sound_next               		


	sz		Flag_all_ready_redial    ;only can redial one time
	jmp		L_Main_exit

	set		Flag_all_ready_redial

	call	F_Redial

	jmp		L_Main_exit

;/////////////////////////////////////////////////////////
L_dial_pause:
;	snz		flag_flash
;	jmp		L_canreal_dial_pause
;	call	F_redial	
;	jmp		L_Main_exit
L_canreal_dial_pause:	
;///                10/29 debug add 
	snz		flag_disc
	jmp		Lajfkqwrqwerqw
	clr		flag_disc
	jmp		L_38key
Lajfkqwrqwerqw:
	sz		flag_flash
	jmp		L_clear_flashkkkii
	jmp		L_notclear_flashkkkii
L_clear_flashkkkii:	
	clr		flag_flash
	clr		R_dial_code_buffer
L_notclear_flashkkkii:
;///                10/29 debug add 

	sz		flag_pause_between      ;11/15 debug add
	jmp		L_not_first_dial         ;save in dial buffer

	call	F_pause_sound       ;when enter number code clear the flag
	call	F_dial_pause             ;dial pause 3.6s
	jmp		L_not_first_dial         ;save in dial buffer

L_dial_pause_over32:
;	call	F_set_sound_p       ;when enter number code clear the flag
	call	F_pause_sound       ;when enter number code clear the flag
	call	F_dial_pause             ;dial pause 3.6s

;	clr		R_dial_code_buffer     ;11/4 debug add
;	clr		flag_save_over32 
	jmp		L_however_cansave      ;11/4 pm.

;	jmp		L_not_first_dial         ;save in dial buffer
;	jmp		L_Main_exit

;;----------------------------------------------------------------

L_is_14:         ;/// Flash key
	set		pdc.2           ;set pd.2 as input
	call	nop4t			;wait port stable 
	snz		pd.2            ;have power=H
	jmp		L_Main_exit

	snz		flag_phone_use   ;[16h].5
	jmp		L_Main_exit

	clr		Flag_first_dial   ;11/9 debug add

;	snz		flag_save_over32
;	set		flag_flash

	mov		a,31
	sub		a,R_dial_code_buffer
	snz		c
	jmp		jkldssad
;	jmp		L_save_over32               		
	;///  dial count <= 32	
;	sz		flag_save_over32
;	clr		R_dial_code_buffer

	sz		R_dial_code_buffer
	set		flag_flash
jkldssad:
L_save_over32_can_notredial_2:
	sz		flag_store
	jmp		L_is_in_store_operating		

	snz		flag_dial_pause      ;11/5 am.
	jmp		Lllllllllllll    	
	set		flag_fuck
	jmp		L_Main_exit
Lllllllllllll:
	sz		pd.1
	SET		flag_earphone

	SZ		flag_earphone
	clr		pd.1
;	clr		Flag_first_dial         ;add add
		clr		[16h].7           ;XMute pin =0 

	call	F_dial_flash
	
		set		[16h].7           ;XMute pin =1 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -