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

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

?? calc.asm

?? 51 計算器 protus keil 源碼 圖
?? 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一区二区三区免费野_久草精品视频
综合久久综合久久| 国产米奇在线777精品观看| 麻豆91在线播放免费| 国产福利一区二区三区在线视频| 日本精品一区二区三区高清| 久久五月婷婷丁香社区| 亚洲大尺度视频在线观看| 国产成人啪免费观看软件| 欧美丰满嫩嫩电影| 亚洲美女视频一区| 国产成人aaa| 日韩一级成人av| 亚洲小说欧美激情另类| voyeur盗摄精品| 久久久久久99久久久精品网站| 日韩成人免费电影| 91福利资源站| 亚洲精品国产无套在线观| 粉嫩在线一区二区三区视频| 日韩欧美视频一区| 青青草原综合久久大伊人精品优势| 91亚洲国产成人精品一区二三 | 色婷婷国产精品| 国产精品入口麻豆九色| 精品一区二区三区影院在线午夜| 在线观看日韩一区| 一区二区三区四区蜜桃| 99国产精品久久久久久久久久| 国产三级三级三级精品8ⅰ区| 奇米影视一区二区三区| 91麻豆精品91久久久久同性| 日韩福利视频网| 6080午夜不卡| 精品一区二区三区在线播放 | 国产另类ts人妖一区二区| 精品国产一区二区亚洲人成毛片| 裸体一区二区三区| 精品成人在线观看| 国产福利一区二区三区视频| 国产精品理伦片| 91麻豆国产在线观看| 亚洲午夜电影网| 欧美精品777| 国产又粗又猛又爽又黄91精品| 精品福利一区二区三区| 成人午夜电影小说| 亚洲欧洲韩国日本视频| 欧美中文字幕亚洲一区二区va在线 | 日韩精品一区二区三区中文不卡| 日产国产欧美视频一区精品| 亚洲精品一区二区三区香蕉| 成人看片黄a免费看在线| 亚洲色图欧洲色图| 欧美日韩免费在线视频| 精品一区二区国语对白| 亚洲欧洲精品一区二区精品久久久 | 色婷婷久久久综合中文字幕| 亚洲国产三级在线| 欧美成人video| www..com久久爱| 天堂久久久久va久久久久| 精品国产一区二区三区不卡| www.在线成人| 蜜桃视频第一区免费观看| 日本一区二区视频在线| 欧美性色黄大片| 国产一区二区三区四区五区入口| ●精品国产综合乱码久久久久| 欧美日韩久久不卡| 国产成人综合亚洲网站| 亚洲伊人伊色伊影伊综合网| ww亚洲ww在线观看国产| 欧美日韩综合在线免费观看| 国产精品一区二区视频| 丝瓜av网站精品一区二区| 国产精品伦理在线| 日韩欧美一区二区在线视频| 91在线视频播放地址| 美女视频一区在线观看| 亚洲久草在线视频| 久久婷婷国产综合精品青草| 欧美视频精品在线| eeuss影院一区二区三区| 精品在线一区二区| 丝袜诱惑亚洲看片| 亚洲免费大片在线观看| 国产丝袜在线精品| 日韩视频免费直播| 精品视频一区二区不卡| 99久久国产免费看| 国产成人av电影在线| 精品一区精品二区高清| 日韩成人一区二区| 亚洲精品videosex极品| 亚洲欧美综合另类在线卡通| 精品人在线二区三区| 欧美巨大另类极品videosbest | 成人免费高清在线| 另类小说图片综合网| 图片区小说区区亚洲影院| 日韩毛片精品高清免费| 国产精品久久久久久久第一福利| 精品播放一区二区| 欧美xingq一区二区| 欧美大片一区二区| 欧美精品久久久久久久久老牛影院| 色婷婷综合久久久中文字幕| 国产suv一区二区三区88区| 国产高清精品网站| 国产伦精品一区二区三区在线观看| 日韩国产欧美在线观看| 日本aⅴ免费视频一区二区三区| 亚洲第四色夜色| 亚洲va中文字幕| 午夜电影一区二区| 午夜精品久久久久久不卡8050| 亚洲国产精品一区二区久久恐怖片 | 日韩va欧美va亚洲va久久| 一区二区高清在线| 亚洲一二三区视频在线观看| 亚洲国产一区二区三区青草影视| 夜夜爽夜夜爽精品视频| 五月综合激情日本mⅴ| 日韩 欧美一区二区三区| 日本在线不卡视频| 激情综合五月婷婷| 成人高清视频免费观看| 色综合久久综合中文综合网| 91在线云播放| 欧美日韩国产成人在线免费| 日韩一区二区三区四区| 久久久精品欧美丰满| 亚洲手机成人高清视频| 天天做天天摸天天爽国产一区| 欧美a一区二区| 国产成人av电影在线| 欧洲国内综合视频| 91精品国产91久久久久久一区二区| 日韩三级.com| 国产精品久久久久影院老司 | 欧美亚日韩国产aⅴ精品中极品| 91福利社在线观看| 欧美一区二区在线看| 国产拍欧美日韩视频二区| 亚洲精品你懂的| 蜜臀a∨国产成人精品| 成人午夜激情在线| 欧美日韩一区高清| 精品不卡在线视频| 一区二区三区高清在线| 激情深爱一区二区| 色噜噜狠狠色综合中国| 2欧美一区二区三区在线观看视频| 中文在线免费一区三区高中清不卡| 一区二区三区在线不卡| 韩国成人精品a∨在线观看| 色悠久久久久综合欧美99| 欧美成人bangbros| 洋洋av久久久久久久一区| 国产精品中文字幕日韩精品 | 欧美精品一区二区三区在线 | 激情av综合网| 91小视频在线免费看| 久久这里只有精品视频网| 亚洲激情中文1区| 国产精品主播直播| 欧美日韩国产精选| 自拍视频在线观看一区二区| 久久se精品一区二区| 欧美日韩综合一区| 中文字幕中文字幕在线一区 | 国产精品系列在线| 日韩电影在线免费看| 成人爱爱电影网址| 亚洲精品一区二区三区精华液| 亚洲在线观看免费| 99亚偷拍自图区亚洲| 国产日韩影视精品| 精品中文av资源站在线观看| 6080日韩午夜伦伦午夜伦| 亚洲欧美视频在线观看| 懂色av一区二区三区蜜臀 | 亚洲色图20p| 精品亚洲成a人| 欧美一级精品在线| 亚洲福利视频三区| 色国产精品一区在线观看| 国产精品久久久久久久久搜平片| 国产真实乱子伦精品视频| 日韩精品一区在线观看| 免费看黄色91| 4438x亚洲最大成人网| 亚洲国产欧美一区二区三区丁香婷| 99热这里都是精品| 中文字幕日本不卡| 91麻豆成人久久精品二区三区| 欧美激情一二三区| 不卡的av网站| 亚洲色图欧美偷拍| 在线精品视频免费观看|