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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? calc.asm

?? 實現(xiàn)簡單的計算器功能,方便又實用,簡單易懂,僅供參考
?? 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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品免费人成网站| 欧美精品三级在线观看| 欧洲一区在线电影| 精品久久久久久无| 亚洲午夜久久久久| 懂色av一区二区夜夜嗨| 欧美日韩电影在线播放| 亚洲国产高清不卡| 日本不卡一区二区三区高清视频| 成人激情电影免费在线观看| 538prom精品视频线放| 亚洲激情中文1区| 成人免费视频视频| 精品国产乱码久久久久久影片| 亚洲激情自拍视频| 日韩美一区二区三区| 一区二区三区中文字幕电影 | 亚洲视频网在线直播| 国模无码大尺度一区二区三区| 欧美三级韩国三级日本三斤| 国产精品免费av| 国产99久久久国产精品潘金网站| 久久精品久久精品| 久久久久久夜精品精品免费| 成人av午夜影院| 午夜久久久久久久久| 欧美精品一区男女天堂| 成人短视频下载| 国产精品嫩草影院com| 91久久线看在观草草青青| 一区二区中文字幕在线| 久久精品国产亚洲一区二区三区| www.亚洲色图| 中文久久乱码一区二区| 高清不卡一区二区在线| 国产日韩三级在线| 国产成人福利片| 中文字幕精品综合| a美女胸又www黄视频久久| 国产精品午夜免费| www.一区二区| 一区二区三区在线免费视频| 91久久精品日日躁夜夜躁欧美| 亚洲免费成人av| 欧美视频自拍偷拍| 日韩成人一级片| 日韩精品一区二区三区在线观看| 狠狠色伊人亚洲综合成人| 精品国产乱码久久久久久浪潮| 激情久久五月天| 中文字幕一区二区在线观看| 国产精品视频免费| 国产美女一区二区| 97se狠狠狠综合亚洲狠狠| 欧美在线看片a免费观看| 久久综合资源网| 国产伦精品一区二区三区视频青涩 | 日韩欧美黄色影院| 国产在线一区二区| 中文字幕在线观看不卡视频| 91国产免费看| 精品综合免费视频观看| 中文字幕+乱码+中文字幕一区| 一本大道综合伊人精品热热| 日本在线不卡一区| 国产欧美综合在线| 欧美久久免费观看| 国产综合成人久久大片91| 中文字幕一区二区在线观看 | 欧美电影免费观看高清完整版在线 | 国产高清不卡一区| 亚洲精品视频一区| 日韩精品一区二区三区蜜臀 | 欧美日韩国产一区二区三区地区| 美女一区二区在线观看| 国产精品美女久久久久aⅴ| 欧美三级电影网站| 国产成人免费视频精品含羞草妖精| 亚洲免费资源在线播放| 亚洲精品一区二区三区99| 欧美制服丝袜第一页| 国产精品66部| 日本午夜一本久久久综合| 18成人在线观看| 亚洲精品一区在线观看| 欧美在线高清视频| 成人蜜臀av电影| 国产综合色视频| 婷婷中文字幕一区三区| 最新成人av在线| 26uuu亚洲综合色欧美| 欧美亚洲国产怡红院影院| 国产91精品一区二区麻豆网站| 日本欧美一区二区三区乱码| 亚洲欧美国产毛片在线| 国产清纯白嫩初高生在线观看91 | 久久午夜色播影院免费高清| 色婷婷av一区二区| av电影天堂一区二区在线观看| 美女mm1313爽爽久久久蜜臀| 亚洲一区av在线| 亚洲女厕所小便bbb| 国产精品久久久久久久午夜片| 欧美大片在线观看一区| 欧美色综合天天久久综合精品| www.欧美.com| 福利一区二区在线观看| 国产呦萝稀缺另类资源| 久久精品国产亚洲高清剧情介绍| 亚洲国产中文字幕| 亚洲不卡在线观看| av资源网一区| 亚洲成人av中文| 国产香蕉久久精品综合网| 在线观看亚洲a| 国产成人亚洲精品青草天美| 亚洲女性喷水在线观看一区| 日韩一区二区三区av| 成人免费三级在线| 蜜桃传媒麻豆第一区在线观看| 中文字幕一区二区三区不卡在线| 欧美一区二区在线观看| 成人午夜视频在线| 首页国产丝袜综合| 一区二区三区四区蜜桃| 久久精品在这里| 欧美一区二区三区免费观看视频| 欧美亚日韩国产aⅴ精品中极品| 激情av综合网| 99精品黄色片免费大全| 激情综合色综合久久综合| 日韩精品免费专区| 久久99久久精品| 国产一区二区女| 亚洲国产精品欧美一二99| 欧美大片免费久久精品三p| 国产乱理伦片在线观看夜一区| 在线不卡欧美精品一区二区三区| av亚洲产国偷v产偷v自拍| 成人性生交大片| 成人免费av网站| 日韩美女视频19| 91精品国产色综合久久不卡蜜臀| 亚洲高清不卡在线观看| 亚洲另类中文字| 婷婷一区二区三区| 看片的网站亚洲| 波多野结衣中文字幕一区 | 欧美日韩综合不卡| 日韩视频免费直播| 国产精品美女久久久久久2018| 亚洲一区二区免费视频| 精品无人码麻豆乱码1区2区| 福利一区二区在线观看| 欧美日韩一区二区三区高清| 精品国产一区二区三区忘忧草| 国产欧美精品一区二区色综合| 一区二区三区四区亚洲| 国产一区二区在线影院| 欧洲一区在线电影| 亚洲国产岛国毛片在线| 婷婷国产在线综合| 99久久99久久久精品齐齐| 日韩午夜在线观看| 一区二区三区免费| 国产精品一区二区在线播放| 欧美日韩高清一区二区三区| 国产三区在线成人av| 亚洲va国产天堂va久久en| 粉嫩在线一区二区三区视频| 91精品国产综合久久香蕉麻豆| 中文字幕视频一区二区三区久| 日本亚洲免费观看| 在线视频国内一区二区| 久久精品人人做人人爽人人| 日本美女一区二区三区视频| 色综合久久中文综合久久97| 国产亲近乱来精品视频| 久久国产乱子精品免费女| 欧美日韩一级视频| 一区二区三区视频在线看| 粉嫩嫩av羞羞动漫久久久| 欧美精品一区二区三| 日韩极品在线观看| 欧美日韩在线观看一区二区| 中文字幕中文字幕中文字幕亚洲无线| 另类综合日韩欧美亚洲| 欧美精品色一区二区三区| 亚洲激情图片小说视频| av网站一区二区三区| 国产精品网曝门| 国产成人综合在线播放| 精品成人佐山爱一区二区| 蜜臀av一级做a爰片久久| 欧美精品精品一区| 午夜久久久久久| 69堂成人精品免费视频| 青青草原综合久久大伊人精品| 欧美性大战xxxxx久久久| 亚洲国产美国国产综合一区二区|