亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? calc.asm

?? 51 計算器 protus keil 源碼 圖
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
		call initialize			; initialise the Keybuffer and the LCD dislay.	
		mov oldopcode,#00		
		mov opcounter,#00 		; Start back at zero operations performed.
		call bufferclear		; Clear the Keybuffer.
		mov decimalcnt,#00h
		jmp co_setflags

co_setflags:	mov pctopflag,#00h		; Set/Clear the appropriate flags.
		mov memopflag,#00h
		mov equalsflag,#00h
		mov arithopflag,#00h

co_done:	call resetsign			; Reset the sign to it's default state ( positive )
		mov status,#01h			; Status = 1 'cause it's an operator press.
		pop DPL				; Restore the Datapointer.
		pop DPH
		ret
		
;---------------------------------------------------------------------------------
;EQUALOP - Subroutine to handle the equals operation.
;---------------------------------------------------------------------------------
		
equalop:	push DPH			; Preserve the Datapointer.
		push DPL	       
		mov mode,#1			; DPTR addresses the Keybuffer.
		call getmode

		mov R5,equalsflag		; Check for repeat Equals presses.
		cjne R5,#1,eo_stattest
		jmp eo_multiple			; If repeated goto multiple.
		

eo_multiple:	call clearscreen		; Repeat Operations.
		mov mode,#3			; Use oldnumbuffer (holding last number)
		call inputnum			; Input the last number.
		mov mode,#1			; Address the Keybuffer.
		call getmode		
		call retrieveop			; Perform the operation and output.	
		mov R5,errorflag		; Test for errors.
		cjne R5,#1,eo_input1
		mov errorflag,#0		; Error found - don't input the number. Clear errorflag ( of no further use ).
		jmp eo_setflags		
eo_input1:	call inputnum			; No error so we can input the number safely.	
		jmp eo_setflags	

eo_stattest: 	mov R5,status
		cjne R5,#1,eo_single 		; If status = 1 goto single else test the operator flags.		

eo_pcttest:	mov R5,pctopflag		; If percentage op then treat the same as multiple press.
		cjne R5,#1,eo_memory
		jmp eo_multiple

eo_memory:	mov mode,#1			; If memory press adjust the bufferctr accordingly.
		mov R5,memcounter
		mov bufferctr,R5		; Run through to eo_single

eo_single:	mov digitcode,#0		; Single Equals.
		call storedigit			; Terminate the  ( second )number.
		mov mode,#1
		call inputnum			; Input the second (second )number. 
		mov copyfrom,#1			
		mov copyto,#3
		call buffercopy			; Copy the (second) number.
		call retrieveop			; Execute the operation and output the result.
				
		mov R5,errorflag
		cjne R5,#1,eo_input		; Test for errors.
		mov errorflag,#0		; Error found. Don't put result back on stack.
		jmp eo_setflags			; Clear the errorflag - we don't need it anymore.
eo_input:	call inputnum			; No error - put result back on stack and continue.	
		
eo_setflags:	mov equalsflag,#01h		; Set/Clear the appropriate flags.
		mov memopflag,#00h
		mov arithopflag,#00h
		mov pctopflag,#00h

eo_done:        call resetsign			; Reset the sign to it's default state ( positive ).
		mov status,#01h			; Operator press so Status = 1.
		pop DPL
		pop DPH				; Reatore the Datapointer.
		ret
		
		
;---------------------------------------------------------------------------------
;SIGNOP - Subroutine to change the sign of the number entered. This is a special case -
;         We treat this as a digit press and not as an operator press. This is a bit of a
;	  fudge to ensure that we get the proper visual output on the LCD screen after the next
;	  keypress ( Screen is cleared on a *op* - *digit* sequence which we don't want here ). 
;---------------------------------------------------------------------------------
signop:		mov mode,#1				; DPTR addresses the Keybuffer.
		call getmode
		
		mov R4,memopflag			
		cjne R4,#1,so_initialize		; Test for MRC press immediately prior to this.
		mov R4,memcounter			; MRC pressed so adjust the bufferctr accordingly.
		mov bufferctr,R4
		
so_initialize:	mov R2,signflag				; R2 holds the signflag
		mov R7,bufferctr			; Preserve the bufferctr in R7
		
so_toggle:	cjne R2,#0,so_negative			; If R2 = 0 then positive else negative
		mov R2,#1				; If positve change to negative
		jmp so_continue
so_negative:	mov R2,#0				; If negative change to positive
		
so_continue:	cjne R2,#0,so_enterneg
		mov digitcode,#020h			; If positive output a space.
		mov bufferctr,#00h			; Output in buffer position 0.
		call storedigit
		jmp so_status
		
so_enterneg:	mov digitcode,#02Dh			; If negative output a minus sign.
		mov bufferctr,#00h			; Output in buffer position zero.
		call storedigit
		
so_status:	mov R4,status				; If the status is one we need to change it to zero
		cjne R4,#1,so_complete			; for a correct visual display on the next keypress
		mov status,#0				; If status is zero we do not change anything.
 							
so_complete:	mov bufferctr,R7			; Restore the bufferctr.
		call bufferoutput			; Output the buffer to the LCD display.
		mov signflag,R2				; Set the signflag.
		ret
		
;---------------------------------------------------------------------------------
;PERCENTOP - Subroutine to work out the percentage.Arithmetically (num1*num2/100) is good for
;	     +,- ,* but we use (num1*100)/num2 to set up the divide case. Ordering the inputs on the 
;	     stack is important for the non - commutitive operators ( -,/).
;---------------------------------------------------------------------------------
percentop:	mov R4,memopflag			; Test for *num1* - *op* - *mrc* - *pct*
		cjne R4,#1,po_stattest	
		jmp po_continue

po_stattest:	mov R4,status				; Test for *num1* - *op* - *num2* -*pct*
		cjne R4,#1,po_continue					
		ret					; If *op* - *pct* do nothing.
po_continue:	mov R5,oldopcode
		cjne R5,#02Fh,po_standard		; Test for Divide Case. 		
		mov mode,#4				; Address the Hundred buffer
		call inputnum				; Input 100.		
		call floating_mul			; Gives us (num1 * 100).

		mov R5,memopflag
		cjne R5,#1,po_divok
		mov mode,#1
		mov R5,memcounter			; Adjust the bufferctr for memory buffer contents.
		mov bufferctr,R5
po_divok:	mov digitcode,#0			; Terminate the number.
		call storedigit
		mov mode,#1				; Address the Keybuffer.	
		call inputnum				; Input the number.
		call floating_div			; Divide.
		call floating_point_output		; Output in Keybuffer.
		call bufferoutput			; Output to LCD Display.
		call inputnum				; Put result back on the stack.
		jmp po_setflags				; End up with (num1*100) / num2.	
		
po_standard:	mov R5,memopflag
		cjne R5,#1,po_stok
		mov mode,#1	
		mov R4,memcounter			; Adjust the bufferctr as appropriate.	
		mov bufferctr,R4
		mov digitcode,#0			; Null terminate.
		call storedigit
		
po_stok:	mov mode,#1				; We can do this for the other 3 cases.
		call inputnum
		call floating_mul
		mov mode,#4
		call inputnum
		call floating_div			; We now have (num1*num2/100)
		

;Multiplication: We effectively have what we want from above. i.e (num1*num2/100 ).

		mov R5,oldopcode
		cjne R5,#02Ah,po_sub			; Test for Multiplication.
		mov mode,#1				; Address the Keybuffer.
		call getmode				
		call floating_point_output		; Output to the Keybuffer.
		call bufferoutput			; Output to the LCD display.
		mov digitcode,#0
		call storedigit				; Terminate.
		call inputnum				; Put result back on the stack.
		jmp po_setflags
		
; Subtraction:	We need to rearrange the numbers on the stack into the proper order before executing.
		
po_sub:		cjne R5,#02Dh,po_add			; Test for Subtraction.	
		mov mode,#1				; Address the Keybuffer.
		call getmode				
		call floating_point_output		; Output to the Keybuffer.
		mov mode,#3				; Address the oldnumbuffer.
		call inputnum				; Input the number 
		mov mode,#1				; Address the keybuffer.
		call inputnum				; Input the number.
		call retrieveop				; Execute the operation.
		call inputnum				; Input the result.
		jmp po_setflags
		
; Addition : Input the number from oldnumbuffer and execute.

po_add:		cjne R5,#02Bh,po_done			; Test for Addition.
		mov mode,#3				; Address the oldnumbuffer.
		call inputnum				; Input.
		mov mode,#1				; Address the Keybuffer.
		call getmode		
		call retrieveop				; Execute the operation and output.
		call inputnum				; Put the result back on the stack.
		jmp po_setflags
		
po_setflags:   	mov memopflag,#00h			; Set/Clear the appropriate flags.
		mov equalsflag,#00h
		mov arithopflag,#00h
		mov pctopflag,#01h
		
po_done:        mov status,#01h				; Set status as it's an operator press.
	        mov mode,#1
		call getmode				; Address the Keybuffer.
		ret
		
		
		
;============================================
;************ MEMORY OPERATORS **************
;============================================



		
;------------------------------------------------------------------------------
;MEMRECALL  - 1 press recalls the memory buffer - 2 consecutive presses clears
;	      the memory buffer.Memory Contents are stored in the MemoryBuffer. 				
;------------------------------------------------------------------------------

memrecall: 	mov R5,memocc			; Test for an empty buffer 
		cjne R5,#0,mr_validate		; If the memory buffer is empty and MRC is pressed
		mov mode,#2			; then initialise the buffer to zero and output to screen. 
		call getmode
		call bufferclear
		mov bufferctr,#00h
		mov digitcode,#030h
		call storedigit
		call bufferoutput
		jmp mr_setflags

mr_validate:	mov R5,memopflag
		cjne R5,#0,mr_consecutive	; test for two consecutive mrc presses.

		mov mode,#2			; Display the contents of the memorybuffer
		call getmode
		mov R4,memcounter		; Adjust the bufferctr.
		mov bufferctr,R4
		call bufferoutput		; Output to the LCD display.	
		
		mov mode ,#1			; Address the Keybuffer.
		call getmode			; Note that we do not input the number onto the stack here
		call bufferclear		; but rather copy it into the Keybuffer. The Stack handling operations 
		mov copyfrom,#2			; are handled inside the arithmetic op subroutine  or the percent subroutine
		mov copyto,#1			; which are the only cases where we might need this number on the stack.
		call buffercopy
		mov memopflag,#1		; Set the flag to indicate a MRC press. 
		jmp mr_setflags

mr_consecutive: mov mode,#2			; Consecutive MRC presses so clear the memorybuffer.
		call getmode
		call bufferclear
		mov status,#1
		call cancelop
		mov memopflag,#0		; Nothing in Memorybuffer so reset.
		mov memocc,#0			
		
mr_setflags:	mov equalsflag,#00h		; Clear opflags as appropriate.
		mov arithopflag,#00h
		mov pctopflag,#00h		


mr_done:	mov mode,#1			; Address the Keybuffer
		call getmode
		mov bufferctr,#00h		; Clear the Bufferctr.
		mov status,#1			; Operator press so set Status = 1.
		ret


;---------------------------------------------------------------------------------
;MEMPLUS - Subroutine to add the entered number to the value in the memory buffer.
;---------------------------------------------------------------------------------
memplus: 	mov mode,#2			; Address the MemoryBuffer as we are as performing 
		call getmode			; addition on it's contents.	
		
		call inputnum			; Input the contents of the memorybuffer (num1)
		call bufferclear
		
		mov mode,#1			; Input the number entered thru keypad  (num2)	
		call inputnum
		call bufferclear		; Clear the Keybuffer

		call floating_add		; Perform num1+num2 and output to memorybuffer
		mov mode,#2			; Address Memorybuffer.
		call getmode	
		call floating_point_output	
		mov R3,bufferctr
		mov memcounter,R3		; Take the length of the outputed number and put in memcounter.
		
		mov memocc,#1			; Indicate that a number is now in the memorybuffer. 
		
		mov mode ,#1			; Copy the result back into the keybuffer and display.
		call getmode
		call bufferclear			
		mov copyfrom,#2
		mov copyto,#1
		call buffercopy
		call bufferoutput				

mp_setflags:	mov memopflag,#00h		; Clear the appropriate flags.
		mov equalsflag,#00h
		mov arithopflag,#00h
		mov pctopflag,#00h	

mp_done:	mov status,#1			; Operator press so set Status = 1.
		ret	

;--------------------------------------------------------------------------------------
;MEMSUB - Subroutine to subtract the entered number from the value in the memorybuffer.
;---------------------------------------------------------------------------------------

memsub: 	mov mode,#2			
		call inputnum			;Input the contents of the memorybuffer (num1)
		call bufferclear		
		
		mov mode,#1			; Input the number entered thru keypad  (num2)	
		call inputnum
		call bufferclear

		call floating_sub		; Perform  num1 - num2		
		mov mode,#2
		call getmode
		call floating_point_output	
		mov R3,bufferctr
		mov memcounter,R3
		
		mov memocc,#1			; Indicate that a number is now in the memorybuffer. 
		
		mov mode ,#1			; Copy the result back into the keybuffer and display.
		call getmode			
		mov copyfrom,#2
		mov copyto,#1
		call bufferclear
		call buffercopy
		call bufferoutput				

ms_setflags:	mov memopflag,#00h
		mov equalsflag,#00h
		mov arithopflag,#00h
		mov pctopflag,#00h

ms_done:	mov status,#1
		ret	


;======================================
;******* UTILITY FUNCTIONS ************
;======================================

;---------------------------------------------------------------------------------
;STOREDIGIT - Subroutine to store a digit. DPTR addresses the KEYBUFFER.
;---------------------------------------------------------------------------------
storedigit:	call getmode	
		push DPH
		push DPL
		mov R5,bufferctr		; move the buffercounter into R5
		
		mov R4,mode			; If we are going into the errorbuffer we allow 25 digits
		cjne R4,#6,sd_entry		; This allows accurate comparison for bounds checking.
		cjne R5,#24,sd_test0
		jmp sd_continue
sd_test0:	jc sd_continue
		jmp sd_done

sd_entry:	cjne R5,#8,sd_test		; test to be sure that a maximum of 8 digits go in the buffer (sign + 8)
		jmp sd_decimal  

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产a毛片| 亚洲国产视频一区| 亚洲成人av电影在线| 激情小说欧美图片| 欧美日韩在线播放一区| 国产亚洲一区二区在线观看| 亚洲国产一区二区视频| 成人在线综合网站| 日韩欧美高清在线| 天堂蜜桃91精品| 欧洲亚洲国产日韩| 国产精品久久久久久妇女6080 | 91猫先生在线| 久久久久久夜精品精品免费| 婷婷成人综合网| 欧美亚洲国产bt| 亚洲精品国产a| av在线播放一区二区三区| 久久久久久久久岛国免费| 蓝色福利精品导航| 777午夜精品视频在线播放| 亚洲伦在线观看| 色综合久久中文字幕综合网 | 中文字幕一区二区三区在线观看| 麻豆精品视频在线观看| 欧美美女黄视频| 亚洲va国产天堂va久久en| 91在线精品一区二区三区| 国产精品色哟哟| av爱爱亚洲一区| 136国产福利精品导航| 成人一区二区三区视频在线观看| 久久久精品蜜桃| 国产精品综合二区| 国产精品嫩草影院com| 成人精品高清在线| 亚洲三级免费电影| 日本高清不卡一区| 亚洲国产欧美日韩另类综合| 欧洲精品在线观看| 性做久久久久久免费观看欧美| 欧美性猛交xxxx乱大交退制版| 亚洲一区二区三区精品在线| 欧美日韩一区二区电影| 午夜伦理一区二区| 日韩欧美电影一二三| 国产精品自在欧美一区| 中文字幕一区二区三中文字幕| 色欧美片视频在线观看 | 精品一区二区三区久久| 久久新电视剧免费观看| 国产成人在线免费观看| 亚洲欧美日韩在线播放| 欧美日韩久久不卡| 黄色成人免费在线| 1000精品久久久久久久久| 欧美日韩成人综合天天影院| 美女www一区二区| 欧美韩日一区二区三区四区| 日本高清成人免费播放| 日本va欧美va欧美va精品| 国产日韩欧美a| 日本韩国欧美一区| 激情综合网最新| 亚洲女性喷水在线观看一区| 欧美一区二区精品久久911| 国产成人自拍网| 婷婷开心激情综合| 国产婷婷色一区二区三区四区| 91极品视觉盛宴| 韩国欧美一区二区| 一区二区三区四区不卡视频 | 欧美在线观看一二区| 蜜臀91精品一区二区三区| 国产精品国产精品国产专区不片| 欧美三级电影在线看| 国产999精品久久| 视频一区二区三区在线| 日本一区二区三区四区| 欧美一区二区久久久| 91麻豆国产福利在线观看| 九九**精品视频免费播放| 玉足女爽爽91| 国产精品日韩成人| 欧美变态tickling挠脚心| 在线观看91精品国产入口| 国v精品久久久网| 免费观看成人av| 亚洲一区二区不卡免费| 欧美韩日一区二区三区四区| 欧美一区二区三区视频| 欧美性受xxxx黑人xyx性爽| 成人午夜碰碰视频| 精品一区二区三区免费视频| 婷婷中文字幕综合| 亚洲激情五月婷婷| 亚洲欧美影音先锋| 国产精品久久久久久久久果冻传媒| 日韩欧美国产一区二区三区 | 日韩一区精品字幕| 一区二区三区日韩欧美| 中文字幕字幕中文在线中不卡视频| 亚洲精品一区二区三区香蕉| 欧美一激情一区二区三区| 欧美日本国产视频| 欧美色精品天天在线观看视频| 91麻豆国产福利精品| 97久久精品人人爽人人爽蜜臀| 国产成人精品一区二区三区四区| 麻豆精品久久久| 国内外成人在线| 国产精品18久久久久久vr| 精品一区二区免费| 国产一区激情在线| 国产精品一二二区| 成人在线视频首页| 99久久99久久精品免费看蜜桃| caoporn国产一区二区| av色综合久久天堂av综合| 97aⅴ精品视频一二三区| 色综合天天做天天爱| 欧美性色欧美a在线播放| 欧美午夜精品久久久久久超碰 | 亚洲午夜私人影院| 亚洲不卡在线观看| 久久www免费人成看片高清| 精品一区二区在线观看| 国产精品综合一区二区三区| 岛国一区二区在线观看| av激情亚洲男人天堂| 欧美亚洲一区二区在线| 欧美一区二区三区不卡| 久久综合999| 中文字幕中文字幕中文字幕亚洲无线| 国产精品三级av在线播放| 亚洲激情av在线| 美腿丝袜亚洲色图| 国产成a人亚洲精品| 日本精品一级二级| 欧美一区二区精品久久911| 国产日韩欧美激情| 亚洲午夜日本在线观看| 蜜臀av在线播放一区二区三区 | 欧美亚洲国产一区在线观看网站| 欧美日韩中文字幕精品| 日韩一区二区三区四区五区六区| 久久精品亚洲国产奇米99| 亚洲欧美另类图片小说| 麻豆精品精品国产自在97香蕉| 成人网男人的天堂| 欧美日韩一区二区欧美激情| 久久久久久久久久久久电影| 亚洲欧美在线视频| 久久精品久久99精品久久| 99久久99久久精品国产片果冻| 欧美日韩免费在线视频| 亚洲精品一线二线三线| 亚洲一区二区三区三| 国产精品资源在线观看| 欧美久久免费观看| 中文字幕在线观看一区| 午夜精品久久久久久久蜜桃app| 国产剧情av麻豆香蕉精品| 欧美天堂亚洲电影院在线播放| 国产欧美一区二区精品性| 亚洲1区2区3区4区| 99久久婷婷国产综合精品电影 | 国产曰批免费观看久久久| 欧美在线免费观看视频| 欧美国产成人在线| 久久99国产乱子伦精品免费| 欧美性欧美巨大黑白大战| 欧美国产激情二区三区| 精品一区二区三区影院在线午夜| 欧美影院午夜播放| 国产精品国产三级国产普通话99 | 91麻豆成人久久精品二区三区| 欧美成人免费网站| 午夜欧美在线一二页| 色悠悠久久综合| 国产精品美女久久久久aⅴ| 国内精品久久久久影院薰衣草| 欧美人狂配大交3d怪物一区| 亚洲色图视频免费播放| 国产99一区视频免费| 欧美精品一区二区久久婷婷| 蜜臀av一区二区三区| 在线电影欧美成精品| 亚洲午夜一区二区三区| 在线欧美一区二区| 亚洲日本在线视频观看| 91亚洲国产成人精品一区二区三| 欧美国产一区视频在线观看| 国产一区日韩二区欧美三区| 精品免费国产二区三区| 乱一区二区av| 精品久久久久av影院| 久99久精品视频免费观看| 精品成人一区二区| 激情久久久久久久久久久久久久久久 |