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

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

?? calc.asm

?? proteus 單片機實現的計算器 可以實現加減乘除幾種計算方式
?? 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一区二区三区免费野_久草精品视频
eeuss国产一区二区三区| 国产高清亚洲一区| 亚洲精品中文字幕乱码三区| 亚洲国产成人一区二区三区| ww久久中文字幕| 久久久久97国产精华液好用吗| 精品久久一二三区| 国产亚洲1区2区3区| 国产日韩av一区| 国产欧美日韩在线| 亚洲婷婷综合色高清在线| 1区2区3区国产精品| 亚洲欧美日韩国产综合在线| 亚洲一区二区三区四区中文字幕| 日韩电影在线看| 理论电影国产精品| 国产乱码字幕精品高清av | 风间由美性色一区二区三区| 国产酒店精品激情| 成人免费观看视频| 日本久久一区二区三区| 欧美日韩成人综合天天影院| 日韩精品一区二区三区四区视频| 久久女同互慰一区二区三区| 中文字幕一区不卡| 青青草91视频| 不卡电影免费在线播放一区| 欧美视频一区二区三区四区| 欧美顶级少妇做爰| 国产精品免费久久| 日韩精品一卡二卡三卡四卡无卡| 国产99精品在线观看| 精品视频一区 二区 三区| 精品国产伦理网| 亚洲少妇30p| 麻豆国产精品777777在线| 处破女av一区二区| 制服丝袜中文字幕亚洲| 国产精品乱码一区二区三区软件| 亚洲va天堂va国产va久| 粉嫩久久99精品久久久久久夜| 欧美区视频在线观看| 日本一区二区不卡视频| 日本三级亚洲精品| 99视频精品在线| 精品国产免费一区二区三区四区| 一区二区三区成人| 国产69精品久久久久777| 欧美一区二区三区电影| 一区二区三区精品在线观看| 国产中文字幕一区| 欧美三级午夜理伦三级中视频| 中文字幕第一页久久| 精品一区二区三区日韩| 欧美日韩1234| 亚洲欧美综合网| 风间由美性色一区二区三区| 精品欧美一区二区三区精品久久| 亚洲va欧美va国产va天堂影院| a级高清视频欧美日韩| 国产日本亚洲高清| 狠狠色丁香久久婷婷综合丁香| 6080午夜不卡| 亚洲不卡av一区二区三区| 99精品欧美一区二区三区综合在线| 精品久久久久久久久久久久久久久| 婷婷亚洲久悠悠色悠在线播放| 91美女片黄在线观看| 中文字幕成人av| 国产成人自拍网| 国产欧美日韩一区二区三区在线观看| 极品瑜伽女神91| 精品国产乱码久久久久久牛牛 | 日韩精品一区国产麻豆| 午夜精品一区二区三区电影天堂| 欧美三级中文字幕| 亚洲国产日韩综合久久精品| 欧美性生活久久| 亚洲综合在线第一页| 欧美少妇性性性| 五月婷婷综合激情| 7777精品伊人久久久大香线蕉超级流畅| 亚洲高清在线精品| 884aa四虎影成人精品一区| 性久久久久久久久久久久 | 精品一区二区在线观看| 久久你懂得1024| 97久久精品人人做人人爽50路 | 日韩一区二区三区四区 | 国产精品护士白丝一区av| proumb性欧美在线观看| 亚洲麻豆国产自偷在线| 欧美丝袜丝nylons| 久久精品99久久久| 中文字幕的久久| 欧美色图在线观看| 老司机精品视频在线| 欧美激情一区二区三区在线| 在线视频亚洲一区| 久久精品国产精品亚洲精品| 国产精品久久三区| 欧美丰满美乳xxx高潮www| 激情都市一区二区| 亚洲精品久久久久久国产精华液| 欧美日韩精品一区二区三区| 国产在线一区观看| 亚洲黄色免费网站| 精品乱码亚洲一区二区不卡| 91免费视频网址| 久久99久久久久久久久久久| 国产精品视频九色porn| 精品视频在线免费| 国产丶欧美丶日本不卡视频| 亚洲一二三四久久| 精品国产乱码久久久久久影片| 91麻豆高清视频| 国产一区二区三区四区五区美女| 亚洲欧美日韩国产成人精品影院 | 91精品欧美综合在线观看最新 | 日韩一区二区三区视频| 99国产精品一区| 激情久久久久久久久久久久久久久久| 亚洲男人天堂一区| 久久精品亚洲国产奇米99| 欧美精品一二三区| 91成人在线精品| 成人av综合一区| 精品一区二区三区日韩| 亚洲成人7777| 亚洲精品中文在线观看| 日本一区二区成人| 亚洲精品免费视频| 国产欧美精品国产国产专区| 日韩一区二区在线免费观看| 欧美主播一区二区三区| av电影在线观看完整版一区二区| 香蕉久久夜色精品国产使用方法 | 欧美videossexotv100| 日本韩国欧美一区| 顶级嫩模精品视频在线看| 久久国产精品第一页| 日韩av中文字幕一区二区三区 | 看片网站欧美日韩| 亚洲二区视频在线| 综合久久久久久久| 国产精品九色蝌蚪自拍| 久久久蜜臀国产一区二区| 精品久久国产老人久久综合| 欧美一级专区免费大片| 91精品国产手机| 欧美男女性生活在线直播观看 | 麻豆国产一区二区| 奇米色一区二区| 美国精品在线观看| 全部av―极品视觉盛宴亚洲| 男男成人高潮片免费网站| 青青草国产精品97视觉盛宴| 老司机午夜精品| 国产成人一级电影| 国产91富婆露脸刺激对白| 成人午夜电影小说| 北条麻妃一区二区三区| 亚洲欧洲99久久| 亚洲国产精品一区二区久久| 亚洲欧美视频一区| 一区av在线播放| 日韩国产在线观看| 久久99久久精品| 99视频一区二区| 色94色欧美sute亚洲线路一久| 欧美中文字幕一区二区三区| 欧美日本高清视频在线观看| 日韩欧美一区电影| 国产精品拍天天在线| 有坂深雪av一区二区精品| 日韩精品一级二级| 国产精品99久久久久| 99久久er热在这里只有精品15| 在线观看日韩国产| 日韩欧美国产一二三区| 亚洲国产成人一区二区三区| 亚洲一区二区三区四区五区黄| 久久99深爱久久99精品| 91亚洲资源网| 日韩免费视频一区| 中文字幕在线不卡一区二区三区| 一区二区三区免费| 精品一区二区综合| 99久久精品国产毛片| 欧美大尺度电影在线| **欧美大码日韩| 久久精品国产成人一区二区三区| 99久久夜色精品国产网站| 欧美一三区三区四区免费在线看| 国产农村妇女毛片精品久久麻豆 | 91福利国产精品| 久久日韩精品一区二区五区| 亚洲综合在线第一页| 国产精品一区二区x88av| 欧美伦理电影网|