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

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

?? calc.asm

?? 51 計算器 protus keil 源碼 圖
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
;4 FUNCTION CALCULATOR PROGRAM
;Assumes 1.2MHz Clock for scan timing.



; TODO : Custom Character for the 'M' sign	
;	 Check instances of multiple decimal point presses ( all covered ?)

;Reset vector
		org 0000h
		jmp start

;Start of the program
		org 0100h

start:		mov A,#030h			;1 line, 8 bits
		call wrcmd
		mov A,#LCD_SETVISIBLE + 4
		call wrcmd
		mov A,#LCD_SETDDADDR+15		; Start at right hand side of the display
		call wrcmd
		mov A,#LCD_SETMODE + 3		; Automatic Increment - Display shift left.  
		call wrcmd

		mov 025h,#00h			; Set output mode (floating point).
		
		call boundsbuffer		; Initialise the bounds buffer - used for error checking.
		mov mode,#4			; Initialise the constant buffer to 100. Primarily used for % ops.
		mov digitcode,#031h
		call storedigit
		mov digitcode,#030h
		call storedigit
		mov digitcode,#030h
		call storedigit

		mov status,#00h			; variable used to determine the first key press after an operation.
		mov bufferctr,#00h
		mov opcounter,#00h
		mov decimalcnt,#00h
		call waitkey		
   
halt:		mov PCON,#1			;Halt


;***********************************************************
;**** Floating Point Package ****
;********************************

$INCLUDE (FP52.ASM)

;Routine to peek arg at DPTR
argout: 	mov R0,#FP_NUMBER_SIZE
aoloop:		movx A,@DPTR
		anl A,#0F0h
		rr a
		rr a
		rr a
		rr a
		add A,#aodata-$-3
		movc A,@A+PC
		call sndchr
		movx A,@DPTR
		anl A,#0Fh
		add A,#aodata-$-3
		movc A,@A+PC
		call sndchr
		inc DPTR
		djnz R0, aoloop
		ret	

aodata:	db '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'

;Routine to output character in A, preserving all but A.
sndchr:		push R0B0
		push R1B0
		call getmode
		mov digitcode,A
		call storedigit
		pop R1B0
		pop R0B0
		ret

;Routine to print error message at DPTR.
prterr: 	jmp wrstr

;Routine to handle input parameter error.
badprm:		mov DPTR,#bpmsg
		jmp wrstr

bpmsg:	db 'Bad Parameter',0


;***********************************************************
;**** LCD Display Routines ****
;******************************

;LCD Registers addresses
LCD_CMD_WR	equ 	00h
LCD_DATA_WR	equ	01h
LCD_BUSY_RD	equ	02h
LCD_DATA_RD	equ	03h

LCD_PAGE	equ	80h

;LCD Commands
LCD_CLS		equ	1
LCD_HOME	equ	2
LCD_SETMODE	equ	4
LCD_SETVISIBLE	equ	8
LCD_SHIFT	equ	16
LCD_SETFUNCTION	equ	32
LCD_SETCGADDR	equ	64
LCD_SETDDADDR	equ	128


;Sub routine to write null terminated string at DPTR in program ram.
wrstr:		mov P2,#LCD_PAGE
		mov R0,#LCD_DATA_WR
wrstr1:		clr A
		movc A,@A+DPTR
		jz wrstr2
		movx @R0,A
		call wtbusy
		inc DPTR
		jmp wrstr1
wrstr2:		ret

;Sub routine to write null terminated string at DPTR in program ram.
wrstrslow:	mov P2,#LCD_PAGE
		mov R0,#LCD_DATA_WR
wrstr1s:	clr A
		movc A,@A+DPTR
		jz wrstr2s
		movx @R0,A
		call wtbusy
		inc DPTR
		push DPL
		push DPH
		mov DPTR,#20
		call wtms
		pop DPH
		pop DPL	
		jmp wrstr1s
wrstr2s:	ret


;Sub routine to write custom character cell A
;with data at DPTR
wrcgc:		mov P2,#LCD_PAGE
		rl A
		rl A
		rl A
		add A,#LCD_SETCGADDR
		call wrcmd

		mov R0,#LCD_DATA_WR
		mov R2,#8
wrcgc1:		clr A
		movc A,@A+DPTR
		movx @R0,A
		call wtbusy
		inc DPTR
		djnz R2, wrcgc1
		ret

;Sub routine to write command:
wrcmd:		mov P2,#LCD_PAGE
		mov R0,#LCD_CMD_WR
		movx @R0,A
		jmp wtbusy
		
	
;Sub routine to write character:
wrdata:		mov P2,#LCD_PAGE
		mov R0,#LCD_DATA_WR
		movx @R0,A
		

;Subroutine to wait for busy clear
wtbusy: 	mov R1,#LCD_BUSY_RD
		movx A,@r1
		jb ACC.7,wtbusy
		ret

;Wait for number of seconds in A
wtsec:		push ACC
		call wtms
		pop ACC
		dec A
		jnz wtsec
		ret

;Wait for number of milliseconds in DPTR
wtms:           xrl DPL,#0FFh			;Can't do DEC DPTR, so do the loop by forming 2's complement
	        xrl DPH,#0FFh			;and incrementing instead.
	        inc DPTR
wtms1:	        mov TL0,#09Ch			;100 ticks before overflow
	        mov TH0,#0FFh	
	        mov TMOD,#1			;Timer 0 mode 1
	        setb TCON.4			;Timer 0 runs
wtms2:	        jnb TCON.5,wtms2	
	        clr TCON.4			;Timer 0 stops
	        clr TCON.5
	        inc DPTR
	        mov A,DPL
	        orl A,DPH
	        jnz wtms1
	        ret

;Subroutine to Center a String on one line of the Display ( 16 character Display )

CentreString:	mov R6,#0
		mov R4,strlength
		mov A,#16		 			; R4 holds the string length.
		subb A,R4     		 			; A holds the total *spare* character spaces.
		jc ExitSub		 			; Exit Routine if string is longer than display width.	                
		rrc A			 			; Shift right (Divide by 2)
		mov R6,A      		 			; R6 now holds the CentreOffset. 
		clr A
CharBuff:	mov A,#CHAR_SPACE				; Write the *padding* to center the string.	
        	call wrdata	
		cjne R6,#0,CharBuff
ExitSub:	ret				


;Subroutine to determine the length of a null terminated string.  

StringLength:	mov R4,#00
loop:		clr A
		movc A,@A+DPTR					
		inc dptr
		inc R4
		jnz loop
		mov strlength ,R4
		ret						; strlength includes the terminating NULL.

;Subroutine to write a null terminated string *wrapped* around an offset.

WriteString:    mov R0,#LCD_DATA_WR
		clr A
		mov A,stroffset					
		mov R5,A					; R5 is the counter.
		mov B,A					        ; B is the counter for the djnz		
                ;mov R7,#5
		mov R6,#16
loop1:		movc A,@A+DPTR                  		; Loop1 goes from the offset to the terminator or to 20 chars -> .
		jz eos_found
		movx @R0,A
		call wtbusy
		inc R5
		mov A,R5
		djnz R6,loop1					; R6 *holds* the string to 20 characters or on 1 line.

eos_found:	mov R5,#0
		mov R2,stroffset
                cjne R2,#0,loop2				; Check for case with no wrap.
		ret
				
loop2:  	mov A,R5					; Loop2 wraps from the first character to the offset.
		movc A,@A+DPTR			
		movx @R0,A
		call wtbusy					
	        inc R5
		djnz B,loop2
             
		push DPL					; Pause after writing the string.
		push DPH
		mov DPTR,#2
		call wtms
		pop DPH
		pop DPL	
		ret

					
;***********************************************************
;**** Keypad Routines ****
;*************************


XSEG 					        ; External Data Memeory - Access through DPTR.

;**** BUFFERS *****
; Buffers are set up with byte 0 as the sign - the relevent number of digits - and the final bit for the terminator.
; The exception to this is the Hundredbuffer which is *hardcoded* at 100. In practice this means that a ten byte
; buffer holds an 8 digit number (sign&number&terminator = 10 ). 

KEYBUFFER:    ds 10				; General I/O buffer. 
OLDNUMBUFFER: ds 10				; Holds the previous number ( used for repeat operations)
MEMORYBUFFER: ds 10				; Holds the number in memory
HUNDREDBUFF : ds 5				; Holds the constant number 100
BOUNDBUFFER:  ds 10				; Holds 99999999 and is signed so both upper and lower bounds can be checked.
TEMPBUFFER:   ds 25				; Holds the operation result until compared with boundsbuffer.

DSEG AT 060h					; Data memory.
	
;***** FLAGS *****
; Flags are used mainly because most of the operators have different functionality when consecutively pressed more than once.
; Status returns 1 after an operator press and 0 after a digit key press.

equalsflag:  	ds 1				; Flag for the equals operator.
memopflag:   	ds 1				; Flag for memory operations.
arithopflag: 	ds 1				; Flag for arithmetic operations.
pctopflag:   	ds 1				; Flag for the percentage operator.
memocc:	     	ds 1				; Flag whether there is a value in the memory buffer

errorflag:   	ds 1				; Flag an error.
signflag:    	ds 1				; Boolean for the sign of the number ( default to +ve ) 	
status:      	ds 1				; Flag the type of key pressed ( operator or digit ).

;***** VARIABLES *****

opcodehex:	ds 1				; Store the operation type.
oldopcode :	ds 1				; As above - must be able to store the last operation as well as the current
						; one for cancel command and consecutive operator presses.
opcodeflag:  	ds 1
bufferctr:   	ds 1				; A counter ( incremented along the buffer on storing a digit ).
opcounter:   	ds 1				; Count the number of operations since a ( total ) Cancel.
digitcode:   	ds 1				; Holds the ascii value of the key pressed.
mode:	     	ds 1				; Determines at which buffer the DTPR addresses.  
memcounter:  	ds 1				; Stores the length of the number currently in the memorybuffer
copyfrom:    	ds 1				; Used to copy the contents of one buffer into another buffer
copyto:		ds 1				; As above.
local:    	ds 1				; Local variable
decimalcnt:	ds 1				; Counter for decimal points - don't allow more than 1 to be inputed per number.
stroffset:	ds 1				; Holds the offset of a string ( for centering purposes ).
strlength:	ds 1				; Holds the length of the string.
CSEG						; Return to code segment.

CHAR_SPACE  equ 0FEh

errorstr: db 'Error!'
	  db 0
string1:  db "YOU'RE JOKING!"
	  db 0

CGC1:	db 010001b				; Memory only.
	db 011011b
	db 010101b
	db 000000b
	db 000000b
	db 000000b
	db 000000b
	db 000000b

CGC2:	db 010001b				; Memory and error.
	db 011011b
	db 010101b
	db 011111b
	db 010000b
	db 011110b
	db 010000b
	db 011111b

CGC3:	db 000000b				; Error only.
	db 000000b
	db 000000b
	db 011111b
	db 010000b
	db 011111b
	db 010000b
	db 011111b
		

	 
;Keycodes returned for function keys:
ON		equ 	1
SGN		equ 	2
PCT		equ	3
SQR		equ 	4
MRC		equ	5
MADD		equ 	6
MSUB		equ	7

KEY_ROW1	equ	0EFh
KEY_ROW2	equ	0DFh
KEY_ROW3	equ	0BFh
KEY_ROW4	equ	07Fh

keyflags	equ	040h

;Data tables for returned row bits

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久精品网| 欧美日韩精品久久久| 久久99精品视频| 五月综合激情婷婷六月色窝| 国产精品久久精品日日| 国产精品传媒入口麻豆| 欧美韩日一区二区三区四区| 国产精品久久久久久久久晋中| 久久久天堂av| **性色生活片久久毛片| 亚洲同性gay激情无套| 18欧美亚洲精品| 亚洲国产视频一区| 日本网站在线观看一区二区三区| 免费视频最近日韩| 国产福利一区二区三区在线视频| 成人午夜视频在线| 91欧美一区二区| 欧美色综合网站| 日韩视频中午一区| 久久综合色综合88| 国产人伦精品一区二区| 亚洲精品免费播放| 日韩精品视频网| 粉嫩欧美一区二区三区高清影视| 91在线观看高清| 日韩免费视频一区二区| 亚洲欧洲成人av每日更新| 三级成人在线视频| 国产一区二区三区综合| 色综合天天做天天爱| 欧美日韩卡一卡二| 久久精品一区八戒影视| 亚洲精品免费在线播放| 极品少妇xxxx精品少妇偷拍| 97久久超碰国产精品| 精品少妇一区二区| 尤物av一区二区| 国产精品一区二区久激情瑜伽 | 亚洲国产视频在线| 激情久久久久久久久久久久久久久久| 99国产精品久| 久久亚洲精品小早川怜子| 一区二区三区日韩| 粉嫩一区二区三区性色av| 337p亚洲精品色噜噜| 亚洲国产精品精华液ab| 蜜臀国产一区二区三区在线播放| 91影院在线观看| 欧美国产丝袜视频| 另类小说综合欧美亚洲| 欧美日韩另类国产亚洲欧美一级| 中文字幕一区二区日韩精品绯色| 久久成人18免费观看| 51久久夜色精品国产麻豆| 一区二区三区在线视频免费观看| 国产.精品.日韩.另类.中文.在线.播放| 欧美日韩高清一区| 亚洲一区二区高清| 91成人在线免费观看| 国产精品素人视频| 国产乱子伦视频一区二区三区| 欧美一级久久久久久久大片| 午夜精品视频在线观看| 在线看国产一区二区| 最新国产成人在线观看| 菠萝蜜视频在线观看一区| 国产三级欧美三级| 国产大陆精品国产| 中文字幕精品—区二区四季| 成人免费毛片片v| 国产精品免费aⅴ片在线观看| 国产精选一区二区三区| 久久免费视频一区| 国产 欧美在线| 国产精品另类一区| 色素色在线综合| 亚洲国产精品天堂| 日韩三级视频在线看| 国模无码大尺度一区二区三区| 精品国产sm最大网站免费看| 久久国产精品露脸对白| 久久美女高清视频| 97精品电影院| 午夜婷婷国产麻豆精品| 日韩一区二区在线看片| 国产精品一区二区黑丝| 国产精品久久久久久久久动漫 | 久久午夜老司机| 国产精品一区二区你懂的| 中文字幕av资源一区| 97久久精品人人爽人人爽蜜臀| 亚洲一区在线视频| 日韩午夜精品电影| 国产成人在线免费观看| 亚洲欧美视频一区| 91精品国产综合久久久久久久 | 久久日韩精品一区二区五区| 国产美女精品一区二区三区| 国产精品乱人伦一区二区| 欧洲av一区二区嗯嗯嗯啊| 免费看黄色91| 国产精品成人一区二区艾草| 欧美日本一道本| 国产一区二区三区久久久| 夜夜嗨av一区二区三区网页| 日韩你懂的在线播放| 色婷婷综合视频在线观看| 久久精品国产精品亚洲红杏| 国产精品欧美经典| 91搞黄在线观看| 精品一区二区三区视频在线观看| 国产精品麻豆网站| 日韩视频免费观看高清完整版在线观看 | 中文字幕综合网| 成人免费视频播放| 自拍偷拍国产精品| 国产最新精品精品你懂的| 欧美日韩精品综合在线| 亚洲图片激情小说| 日韩精品一区二区在线观看| 欧美一卡2卡3卡4卡| 欧美电视剧在线看免费| 欧美一区二区女人| 欧美成人女星排名| 国产亚洲精品超碰| 国产精品久久久久久久久免费丝袜 | 91麻豆精品国产91久久久资源速度 | 国产精品免费看片| 一区二区三区在线视频播放| 亚洲国产精品自拍| 久久精品国产色蜜蜜麻豆| 丁香婷婷深情五月亚洲| 不卡电影免费在线播放一区| 91丨porny丨蝌蚪视频| 欧美性色欧美a在线播放| 99国产精品国产精品毛片| 欧美性受xxxx黑人xyx| 在线日韩国产精品| 在线播放中文字幕一区| 久久天天做天天爱综合色| 国产精品久久99| 亚洲国产一二三| 麻豆精品在线看| a级精品国产片在线观看| 色av成人天堂桃色av| 欧美一区二区成人6969| 日本一区二区免费在线| 亚洲精品免费在线播放| 久久er99热精品一区二区| 不卡大黄网站免费看| 91麻豆精品国产91久久久久久久久 | 欧美日韩日本视频| 久久蜜桃av一区二区天堂| 一区二区三区中文字幕| 黄一区二区三区| 91黄色免费版| 久久久高清一区二区三区| 亚洲精品成人天堂一二三| 紧缚捆绑精品一区二区| 一本色道久久综合亚洲91 | 欧美日韩在线三级| 久久久久免费观看| 亚洲成人免费视| 不卡大黄网站免费看| 精品奇米国产一区二区三区| 成人欧美一区二区三区白人| 极品少妇一区二区| 欧美精品久久天天躁| 一区二区三区在线观看欧美| 国产伦精品一区二区三区视频青涩| 色综合天天综合网国产成人综合天| 精品免费99久久| 首页欧美精品中文字幕| 色女孩综合影院| 中文字幕一区在线观看视频| 国产永久精品大片wwwapp| 日韩一区二区三区免费观看| 亚洲午夜一二三区视频| 91久久免费观看| 中文字幕在线不卡一区| 国产成人在线视频免费播放| 精品福利一二区| 精品一区二区在线看| 欧美电影一区二区| 亚洲成在线观看| 在线观看成人免费视频| 亚洲精品伦理在线| 91蜜桃免费观看视频| 中文字幕综合网| 91老司机福利 在线| 国产精品伦一区二区三级视频| 国产69精品久久久久777| 久久久久国产精品厨房| 国产suv精品一区二区883| 久久久另类综合| 成人综合在线网站| 国产精品的网站| 色偷偷一区二区三区| 一区二区在线观看免费视频播放|