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

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

?? calc.asm

?? proteus 單片機實現的計算器 可以實現加減乘除幾種計算方式
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
sd_test:	jc sd_decimal   
		
		
sd_decimal:	mov R4,digitcode		; Test for decimal points - only  allow one per number to be inputed.
		cjne R4,#02Eh,sd_continue
		inc decimalcnt			; We need to see whether this is the first decimal point to be inputed in this number.
		mov R3,decimalcnt		; This will be reset in the inputnum subroutine when we are finished with the number.
		cjne R3,#1,sd_done		; It is a decimal point and it is not the first so don't store it.
						; Fall through to sd_continue if it is the first decimal point.				
sd_continue:	cjne R5,#0,sd_loop		; If it is zero goto write
		jmp sd_write			;

sd_loop:	inc DPTR	
		djnz R5,sd_loop			; increment DPTR to DPTR + bufferctr
		
sd_write:	mov A,digitcode
		movx @DPTR,A			; Write the digit into the Buffer
		inc bufferctr			; we write digits from bufferctr pos 1 - 8.
						; Buffer position 0 is reserved for the sign.
			
sd_done:	pop DPL
		pop DPH
	        ret
;---------------------------------------------------------------------------------
;STATUSCHECK - Subroutine to test if this is the first key pressed after an operation
;	       and if so to clear the screen.	
;---------------------------------------------------------------------------------
statuscheck:	mov R2,status			
		cjne R2,#1,sc_done		
		mov R2,equalsflag
		cjne R2,#1,sc_clear

		mov R4,digitcode		; This caters for num - op - num - equ - num. A number after an equals 
		mov local, R4			; signifies a new calculation.
		mov mode,#3
		call getmode
		call floating_point_output
		call bufferclear
		mov opcounter,#0
		mov bufferctr,#00h
		mov digitcode,#020h
		call storedigit
		mov R4,local
		mov digitcode,R4
		mov mode,#1
		call getmode
		mov decimalcnt,#00h
sc_clear:	mov status,#00h		
			
				
sc_setflags:	mov memopflag,#00h
		mov equalsflag,#00h
		mov arithopflag,#00h
		mov pctopflag,#00h
sc_done:	ret				; clear status to indicate that a digit key has been pressed.
;---------------------------------------------------------------------------------
;BUFFEROUTPUT - Subroutine to write the keybuffer onto the screen.
;---------------------------------------------------------------------------------
bufferoutput:	push DPH			; preserve the Datapointer
		push DPL
		
		call clearscreen		; clears the screen and sets the LCD address to the far right.
		call getmode			; point at the keybuffer
		mov R3,bufferctr     		; We know the length of the number from the bufferctr
		mov bufferctr,#0
		mov R5,#0

bo_start:	mov R7,bufferctr
		clr A
bo_output:	movx A,@DPTR			; read the digit into A
		;cjne A,#02Eh,bo_write		; if a decimal point don't count that as one of the 8 output chars.
		;dec R5
		;jmp bo_write

bo_write:	call wrdata			; write out the digit.				
		
bo_test:	clr c				; need to clear the carry before the subb instruction.
		mov  A,R3			; test for the end of the string.
		subb A,R7
		mov R7,A			
		clr A
	        cjne R7,#01h,bo_test2		
		jmp bo_sign

		
bo_test2:   	cjne R5,#8,bo_test3
		jmp bo_increment			
bo_test3:	jc bo_increment
		jmp bo_sign

bo_increment:	inc bufferctr
		inc R5
		inc DPTR
		jmp bo_start
		
bo_sign:	mov R4,memocc
		cjne R4,#1,bo_done
		mov A,R3			; Draws the 'M' on the far left when there is a number
		add A,#LCD_SETDDADDR + 1	; in the memory buffer. We need to offset by the amount of the
		call wrcmd			; buffercounter because of the *shift* mode we have the LCD display
		mov A,#04Dh			; set up in.
		call wrdata

bo_done:	mov bufferctr,R3
		pop DPL
		pop DPH
		ret
;---------------------------------------------------------------------------------
;BUFFERCLEAR - Subroutine to clear the keybuffer.
;---------------------------------------------------------------------------------
bufferclear:	push DPH
		push DPL
		call getmode
		mov R2,#9			; Clear the buffer.
		mov A,#0					
bc_loop:	movx @DPTR,A			; Write a zero into the buffer position addressed by DPTR
		inc DPTR			; move the Datapointer along the databuffer. 
		djnz R2,bc_loop			; loop through the bufferlength		
		pop DPL
		pop DPH
		ret
;---------------------------------------------------------------------------------
;CLEARSCREEN - Subroutine to clear the screen and set the writing to the RHS.
;---------------------------------------------------------------------------------
clearscreen:	mov A,#LCD_CLS
		call wrcmd
		mov R4,memocc			; We need to account for the extra digit outputed ( 'M' ) when
		cjne R4,#1,cs_standard		; there is a number in memory. Due to the mode that we have set the 
		mov A,#LCD_SETDDADDR + 16	; display in (i.e. shifts display left) we need ddaddress set one further  
		call wrcmd			; right in this case.
		jmp cs_done
cs_standard:	mov A,#LCD_SETDDADDR + 15	; Standard case when nothing is in memory (output number only ) 
		call wrcmd
cs_done:	ret
;---------------------------------------------------------------------------------
;BUFFERCOPY - Subroutine to copy the keybuffer contents into  oldnumbuffer.
;---------------------------------------------------------------------------------
buffercopy:	push DPH			; Preserve the DataPointer
		push DPL
		mov R7,bufferctr		; Preserve the Bufferctr
		mov bufferctr,#00h
		mov R2,#8			; Set the counter to the buffer size

bc_transfer:	
		mov R5,bufferctr

		mov R6,copyfrom			; Get the copy info. 
		mov mode,R6			; ( set to a mode depending on which buffer we wish to access )
		call getmode			

		cjne R5,#0,bc_address1
		jmp bc_readin

bc_address1:	inc DPTR
		djnz R5,bc_address1

bc_readin:	movx A,@DPTR

		;cjne A,#020h,bc_continue
		;jmp bc_increment

bc_continue:	mov R6,copyto
		mov mode,R6
		call getmode

		mov R5,bufferctr
		cjne R5,#0,bc_address2
		jmp bc_writeout
bc_address2:	inc DPTR
		djnz R5,bc_address2

bc_writeout:	movx @DPTR,A 

bc_increment:	inc bufferctr			; loop through the Buffersize .
		djnz R2,bc_transfer
		
		mov bufferctr,R7		; Restore Bufferctr
		mov mode,#1
bc_done:        pop DPL
		pop DPH
		ret
;---------------------------------------------------------------------------------
;INPUTNUM - Subroutine to push the number onto the stack.
;---------------------------------------------------------------------------------
inputnum:	call getmode			; move the DPTR back to the beginning of the appropriate buffer
		call floating_point_input	; move the contents of the keybuffer onto the floating point stack	
		mov bufferctr,#00h		; move the buffercounter back to zero ready for the next operation
		mov decimalcnt,#00h		; Reset the decimal point counter for the next number.
		ret
;---------------------------------------------------------------------------------
;INITIALIZE - Subroutine to initialize the calc on startup.
;---------------------------------------------------------------------------------
initialize: 	mov mode,#1			; set the mode to default ( DPTR, points at the KEYBUFFER )
		call getmode			; Set the DPTR to address the appropriate buffer.
		call bufferclear
		mov bufferctr,#00h
		mov digitcode,#020h		; initialise with a space in position 0 to indicate a positive number.
		call storedigit
	
		mov signflag,#0
		mov status,#1			; start with status = 1 so if an op is pressed first 0 becomes the first no
						; on the stack - if a digit is pressed first the zero is trashed.
		call clearscreen		; sets the ddaddress to be at  the RHS
		mov digitcode,#30h		; start with 0 on the screen
		call storedigit
		call bufferoutput
		mov R4,bufferctr
		dec R4
		mov bufferctr,R4
		
		ret				
;---------------------------------------------------------------------------------
;RESETSIGN - Subroutine to ensure that every number starts as being positive.
;---------------------------------------------------------------------------------
resetsign:	call getmode			; point at the buffer to clear.
		call bufferclear
		
		mov bufferctr,#00h		; Clear the signfrom the buffer and set the buffer position.
		mov digitcode,#020h		; StoreDigit increments the buffer position *AFTER* storage.
		call storedigit			; This leaves us with position 0 clear and bufferctr set to 1.
		mov signflag,#00h
rs_done:	ret
;----------------------------------------------------------------------------------------------
;GETMODE - Subroutine to point the Datapointer at the required buffer - dependant on the mode.
;----------------------------------------------------------------------------------------------
getmode:	mov R4,mode
		cjne R4,#1,gm_memory
		mov DPTR,#KEYBUFFER
		jmp gm_done

gm_memory:	cjne R4,#2,gm_oldnum
		mov DPTR,#MEMORYBUFFER
		jmp gm_done

gm_oldnum:	cjne R4,#3,gm_const
		mov DPTR,#OLDNUMBUFFER
		jmp gm_done

gm_const:	cjne R4,#4,gm_bounds
		mov DPTR,#HUNDREDBUFF
		jmp gm_done
gm_bounds:	cjne R4,#5,gm_temp
		mov DPTR,#BOUNDBUFFER
		jmp gm_done
gm_temp:	cjne R4,#6,gm_done
		mov DPTR,#TEMPBUFFER			
gm_done:	ret

;----------------------------------------------------------------------------------------------
;BOUNDSBUFFER- Generate a buffer with the maximum permissable value i.e 99999999
;----------------------------------------------------------------------------------------------

boundsbuffer:	push DPH
		push DPL
		mov mode,#5
		mov R3,bufferctr		; Preserve the bufferctr.
		mov bufferctr,#0
		mov digitcode,#020h
		call storedigit			
bb_loop:	mov digitcode,#039h		; Enter  digit 9.
		call storedigit
		mov  R4,bufferctr
		cjne R4,#9, bb_loop
		mov digitcode,#0
		call storedigit
		mov bufferctr,R3
		
bb_done:	pop DPL
		pop DPH
		ret


;----------------------------------------------------------------------------------------------
;ERRORCHECK - Checks the upper and lower bounds and divide by zero. 
;----------------------------------------------------------------------------------------------

errorcheck:	jb ACC.3,ec_divide		; Result is on the stack.
		mov errorflag,#01h		; We set the error flag here and clear it if appropriate later.
		mov mode,#6			; output and then input result
		call getmode
		mov bufferctr,#0
		call floating_point_output
		call inputnum

		mov mode,#5
		mov bufferctr,#0
		mov digitcode,#020h
		call storedigit
		call inputnum			; input the UBound on the stack
		clr c
		call floating_comp		; Call floating_compare ( pops twice and returns status ).
		jc ec_lower			; Carry set so less than Ubound
		jmp ec_upperr			; Otherwise error - result too large.
		
ec_lower:	mov mode,#6
		call inputnum			; input result
		
		mov mode,#5			; make the max number negative ( i.e. the lower bound )
		mov bufferctr,#0
		mov digitcode,#02Dh
		call storedigit
		mov mode,#5
		call inputnum			; input the lower bound.	

		clr c
		call floating_comp
		jc ec_lowerr			; Error - result too low
		
		jmp ec_ok			; Greater than lower bound so o.k.

ec_divide:	call clearscreen
		mov DPTR,#errorstr		; Error message.
		call wrstr
		mov DPTR,#500
		call wtms
		mov mode,#6
		call inputnum			; input result.
		mov mode,#1
		call getmode
		mov status,#1
		jmp ec_done

ec_upperr:	call clearscreen
		mov DPTR,#errorstr		; Error message.
		call wrstr
		mov DPTR,#500
		call wtms
		mov mode,#6
		call inputnum			; input result.
		mov mode,#1
		call getmode
		mov status,#1
		jmp ec_done

ec_lowerr:	call clearscreen
		mov DPTR,#errorstr		; Error Message
		call wrstr
		mov DPTR,#500
		call wtms
		mov mode,#6
		call inputnum			; input result.
		mov mode,#1
		call getmode
		mov status,#1
		jmp ec_done


ec_ok:		mov mode,#6
		call inputnum			; input result.
		mov errorflag,#00h
	
ec_done:	mov mode,#6
		call getmode
		call bufferclear
		mov mode,#1
		call getmode
		ret


;----------------------------------------------------------------------------------------------
;BANNER - Exports a wraparound banner to the LCD screen. 
;----------------------------------------------------------------------------------------------

Banner:		
	
		call clearscreen
		mov A,#LCD_SETDDADDR+16		; Start at right hand side of the display
		call wrcmd
		
Reloop:		mov DPTR,#STRING1        			
                
Iterate:	call wrstr

		mov DPTR,#1000
		call wtms
	
		call clearscreen
		ret

END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜精品久久久久久孕妇| 91精品国产美女浴室洗澡无遮挡| 色综合久久天天综合网| 日韩欧美综合在线| 一区二区三区四区激情| 国产综合久久久久久鬼色| 欧美午夜不卡在线观看免费| 中文字幕中文字幕在线一区 | 欧美变态tickling挠脚心| 亚洲欧美一区二区在线观看| 蜜桃视频一区二区三区在线观看| 91福利资源站| 亚洲欧洲精品天堂一级| 国产成人综合亚洲91猫咪| 91精品黄色片免费大全| 午夜伊人狠狠久久| 91久久人澡人人添人人爽欧美 | 欧美成人精品1314www| 亚洲成人中文在线| 欧美天堂一区二区三区| 亚洲天堂中文字幕| av亚洲精华国产精华| 国产欧美精品一区二区色综合| 精品在线免费视频| 欧美v国产在线一区二区三区| 日日夜夜一区二区| 欧美精品v国产精品v日韩精品| 亚洲午夜在线视频| 欧美性xxxxxx少妇| 午夜久久福利影院| 欧美久久久久久蜜桃| 天天免费综合色| 欧美疯狂性受xxxxx喷水图片| 天天操天天综合网| 日韩免费一区二区| 国产乱码精品一区二区三区五月婷| 日韩一区二区不卡| 国内精品伊人久久久久av一坑| 精品av久久707| 国产99久久久国产精品潘金| 国产精品拍天天在线| 色综合天天综合网天天看片| 亚洲美女精品一区| 欧美久久免费观看| 国产一区二区看久久| 久久九九国产精品| 99久久免费视频.com| 亚洲一区二区成人在线观看| 欧美伊人久久大香线蕉综合69| 亚洲最大的成人av| 欧美日本免费一区二区三区| 午夜欧美大尺度福利影院在线看| 欧美剧情电影在线观看完整版免费励志电影| 日本亚洲电影天堂| 亚洲精品一区在线观看| av中文字幕亚洲| 亚洲成人久久影院| 久久综合网色—综合色88| 成人h版在线观看| 亚洲国产视频一区二区| 精品国产一区二区三区四区四 | 久久激五月天综合精品| 国产欧美日韩视频在线观看| 色婷婷综合久色| 日韩精品午夜视频| 欧美经典一区二区三区| 丁香六月综合激情| 亚洲图片欧美一区| 久久综合久久99| 欧美三级中文字幕在线观看| 韩国视频一区二区| 亚洲午夜在线电影| 国产精品美日韩| 日韩色视频在线观看| jiyouzz国产精品久久| 蜜桃久久久久久| 国产精品护士白丝一区av| 日韩一区二区三区视频在线| 成人av电影免费在线播放| 日韩福利视频导航| 亚洲欧美韩国综合色| 久久久久成人黄色影片| 3d成人动漫网站| 色又黄又爽网站www久久| 国模冰冰炮一区二区| 亚洲成人精品一区二区| 亚洲天堂a在线| 久久久五月婷婷| 91麻豆精品国产91久久久资源速度| www.色精品| 国产91在线观看丝袜| 久久99热国产| 日本不卡视频在线观看| 亚洲一区二区在线播放相泽| 欧美激情一区二区三区四区| 欧美成人激情免费网| 欧美精品在欧美一区二区少妇| 95精品视频在线| 成人性色生活片| 国产成人免费视| 精品亚洲成a人在线观看| 日韩综合在线视频| 亚洲成人www| 一区二区三区影院| 亚洲精选一二三| 亚洲欧美激情一区二区| 最好看的中文字幕久久| 国产精品欧美久久久久无广告| 久久久久亚洲综合| 久久久综合精品| 精品久久久久av影院| 日韩欧美不卡一区| 欧美videos中文字幕| 日韩欧美第一区| 久久久噜噜噜久久人人看| 久久影院午夜片一区| 久久久国产一区二区三区四区小说 | 精品日韩在线观看| 精品美女一区二区| 久久久久久久久蜜桃| 久久久国产精品午夜一区ai换脸| 久久综合精品国产一区二区三区| 久久亚洲捆绑美女| 国产视频911| 亚洲欧洲日韩av| 亚洲在线免费播放| 石原莉奈在线亚洲三区| 美日韩一级片在线观看| 国产在线精品不卡| 成人av午夜电影| 色av成人天堂桃色av| 欧美日韩大陆在线| 欧美一区二区三级| 国产婷婷色一区二区三区四区| 国产欧美视频一区二区| 亚洲九九爱视频| 另类小说视频一区二区| 国产精品 日产精品 欧美精品| 成人丝袜高跟foot| 欧美色视频在线| 欧美sm极限捆绑bd| 亚洲视频一区二区在线| 亚洲成人免费电影| 国产成人av网站| 欧美性猛交xxxx乱大交退制版| 欧美变态tickle挠乳网站| 国产精品福利一区二区| 日韩激情一二三区| 国产超碰在线一区| 欧美三级资源在线| 国产香蕉久久精品综合网| 一区二区在线观看视频| 国模套图日韩精品一区二区| 色综合天天综合网天天看片| 欧美成人aa大片| 亚洲精品大片www| 精品一区中文字幕| 色婷婷综合久久久久中文| 日韩视频在线你懂得| 成人欧美一区二区三区1314| 蜜臀av性久久久久av蜜臀妖精| 国产成人一级电影| 欧美美女bb生活片| 国产精品久久久久久久久久久免费看 | 99re在线精品| 精品国产免费人成在线观看| 一区二区三区四区蜜桃| 粉嫩在线一区二区三区视频| 制服丝袜av成人在线看| 亚洲精品水蜜桃| 懂色av一区二区在线播放| 91精品国产入口在线| 樱桃国产成人精品视频| 成人综合婷婷国产精品久久| 日韩一区二区三区四区| 亚洲va天堂va国产va久| 91在线国产观看| 国产精品色哟哟| 精品一二三四区| 91精品国产一区二区| 亚洲一区二区三区四区五区黄| 风流少妇一区二区| 日韩欧美一二三四区| 日韩毛片高清在线播放| 国产精品一品二品| 日韩午夜三级在线| 视频一区在线视频| 91传媒视频在线播放| 亚洲视频在线观看三级| 成人免费视频网站在线观看| 久久久久久久久久久电影| 日韩成人免费电影| 欧美日韩另类一区| 亚洲午夜精品在线| 色综合久久久网| 亚洲精品老司机| 在线中文字幕不卡| 一区二区三区国产精华| 日本高清免费不卡视频| 亚洲另类春色校园小说|