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

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

?? calc.asm

?? 實現簡單的計算器功能,方便又實用,簡單易懂,僅供參考
?? 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一区二区三区免费野_久草精品视频
日韩在线一二三区| 国产一区二区伦理| 久久综合99re88久久爱| 色吧成人激情小说| 国模冰冰炮一区二区| 亚洲视频中文字幕| 久久夜色精品一区| 日韩一区二区免费在线观看| 成人免费毛片高清视频| 婷婷一区二区三区| 亚洲精品乱码久久久久久黑人 | 不卡大黄网站免费看| 天堂在线一区二区| 亚洲欧洲另类国产综合| 久久综合九色综合97婷婷女人 | 亚洲三级在线观看| 久久天天做天天爱综合色| 91超碰这里只有精品国产| 99精品在线免费| 国产风韵犹存在线视精品| 奇米777欧美一区二区| 亚洲精品免费在线播放| 国产精品久久久久婷婷二区次| 日韩一级完整毛片| 欧美猛男gaygay网站| 色欲综合视频天天天| 99久久er热在这里只有精品15| 国产伦精品一区二区三区视频青涩 | 国产成人综合自拍| 捆绑调教美女网站视频一区| 亚洲国产毛片aaaaa无费看 | 美女视频黄久久| 亚洲国产色一区| 亚洲综合视频在线| 亚洲一区二区在线免费看| 亚洲黄色小视频| ...中文天堂在线一区| 亚洲国产高清aⅴ视频| 久久精品欧美一区二区三区麻豆| 精品国产乱码久久久久久1区2区| 精品盗摄一区二区三区| 欧美精品一区二区不卡| www激情久久| 久久久91精品国产一区二区精品| 2019国产精品| 久久精品亚洲国产奇米99 | 午夜精品福利一区二区三区av | 久久精品国产精品亚洲红杏| 麻豆久久久久久| av资源网一区| 国产suv精品一区二区6| www.欧美.com| 色av综合在线| 欧美精品 国产精品| 91精品国产91久久久久久最新毛片| 6080日韩午夜伦伦午夜伦| 日韩三区在线观看| 久久精品一区二区三区四区| 国产精品色一区二区三区| 亚洲视频1区2区| 亚洲国产精品久久艾草纯爱| 免费成人性网站| 国产麻豆精品在线| 91亚洲午夜精品久久久久久| 欧美性三三影院| 欧美一级在线观看| 久久久久88色偷偷免费| 国产精品人成在线观看免费| 亚洲美女一区二区三区| 午夜精品在线视频一区| 久久99精品一区二区三区三区| 国产精品自拍一区| 色哟哟一区二区在线观看| 91精品国产综合久久精品| 久久精品亚洲精品国产欧美kt∨| 亚洲三级在线看| 美女脱光内衣内裤视频久久影院| 成人性生交大合| 欧美人与z0zoxxxx视频| 久久精品一区蜜桃臀影院| 亚洲人成亚洲人成在线观看图片| 日本不卡在线视频| 成人精品视频.| 制服丝袜亚洲精品中文字幕| 国产欧美一区二区三区在线老狼| 亚洲免费毛片网站| 精品影视av免费| 97成人超碰视| 精品国产乱码久久久久久免费| 亚洲欧美激情视频在线观看一区二区三区| 午夜久久久久久久久久一区二区| 国产成人亚洲综合a∨婷婷| 欧美体内she精高潮| 欧美精品一区在线观看| 一区二区三区国产豹纹内裤在线| 久久国产综合精品| 一本一本久久a久久精品综合麻豆| 欧美一区二区三区日韩| 亚洲欧美激情视频在线观看一区二区三区 | 精品卡一卡二卡三卡四在线| 国产精品女人毛片| 日产欧产美韩系列久久99| 92精品国产成人观看免费| 亚洲精品一区二区三区99| 亚洲成av人片在线观看无码| 成人一道本在线| 精品久久久久一区| 午夜激情综合网| 91免费视频大全| 国产亚洲一区二区三区| 日本午夜一本久久久综合| 91日韩精品一区| 国产日韩av一区| 国内精品久久久久影院薰衣草| 9191国产精品| 午夜精品免费在线| 欧美综合天天夜夜久久| 亚洲色图清纯唯美| 高清不卡一区二区| 久久免费偷拍视频| 精品一区二区在线免费观看| 制服丝袜中文字幕亚洲| 亚洲第一成年网| 欧美在线视频你懂得| 亚洲欧美国产毛片在线| 成人h动漫精品| 国产精品午夜春色av| 高清shemale亚洲人妖| 26uuu亚洲| 国产精品一线二线三线| www欧美成人18+| 国产成人综合在线观看| www激情久久| 成人在线视频一区| 国产精品国产三级国产普通话三级| 国产精品亚洲成人| 亚洲国产精品精华液ab| 国产a级毛片一区| 中文无字幕一区二区三区| 国产91对白在线观看九色| 国产欧美一区二区三区在线看蜜臀 | 在线观看91精品国产入口| 亚洲美女屁股眼交| 欧美综合天天夜夜久久| 亚洲永久精品大片| 欧美日韩一区 二区 三区 久久精品| 亚洲综合自拍偷拍| 欧美日韩亚洲另类| 蜜臀久久99精品久久久久宅男| 日韩一级二级三级精品视频| 精品一区二区日韩| 国产亚洲成aⅴ人片在线观看| 粉嫩在线一区二区三区视频| 亚洲美女视频在线| 欧美精品日韩一本| 久久精品久久综合| 久久人人97超碰com| 99综合电影在线视频| 一区二区三区丝袜| 91精品国产色综合久久不卡蜜臀| 麻豆国产精品一区二区三区| 久久久三级国产网站| 99国内精品久久| 亚洲地区一二三色| 久久久91精品国产一区二区三区| 97se亚洲国产综合自在线| 亚洲成人一区二区| 久久午夜国产精品| 91免费观看视频| 日韩av在线播放中文字幕| 久久精品一区蜜桃臀影院| 色悠悠久久综合| 久久精品国产免费看久久精品| 中文字幕第一页久久| 欧美人成免费网站| 国产精品夜夜嗨| 一级女性全黄久久生活片免费| 欧美mv日韩mv国产网站| 成+人+亚洲+综合天堂| 亚洲成a人片在线观看中文| 国产午夜一区二区三区| 色婷婷久久久久swag精品| 毛片不卡一区二区| 亚洲人被黑人高潮完整版| 欧美刺激脚交jootjob| 99精品国产91久久久久久| 麻豆精品视频在线| 亚洲乱码国产乱码精品精可以看| 精品国产亚洲一区二区三区在线观看| 成人aa视频在线观看| 麻豆精品久久精品色综合| 亚洲欧洲韩国日本视频| 日韩三级视频中文字幕| 色综合久久中文综合久久牛| 久久精品国产精品亚洲综合| 亚洲在线视频免费观看| 国产午夜精品一区二区三区四区| 欧美网站一区二区| 成人一区二区视频| 激情六月婷婷久久|