亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美性生交片4| 男男gaygay亚洲| 激情亚洲综合在线| 欧美色区777第一页| 亚洲三级在线免费观看| 成人自拍视频在线观看| 国产亚洲制服色| 国产中文字幕一区| 欧美精品一区在线观看| 老汉av免费一区二区三区 | 成人av动漫网站| 中文字幕欧美三区| 国产98色在线|日韩| 国产日本欧美一区二区| 国产宾馆实践打屁股91| 中文字幕国产一区二区| 日韩高清欧美激情| 91精品婷婷国产综合久久竹菊| 午夜精品成人在线视频| 欧美日韩一区二区三区四区五区 | 亚洲综合色婷婷| 日本韩国精品在线| 亚洲国产美国国产综合一区二区| 在线成人免费观看| 久久精工是国产品牌吗| 国产视频亚洲色图| 99久久久精品免费观看国产蜜| 亚洲欧洲av在线| 欧美主播一区二区三区| 亚洲一本大道在线| 欧美高清hd18日本| 国产精品一区二区三区网站| 国产精品美女久久久久久久久| eeuss鲁片一区二区三区在线看| 亚洲女性喷水在线观看一区| 欧美日韩电影在线播放| 久久99精品国产.久久久久| 欧美极品美女视频| 在线免费亚洲电影| 日本中文在线一区| 久久久久国产免费免费 | av在线不卡观看免费观看| 自拍偷拍亚洲综合| 欧美日本国产一区| 国产一区二区在线免费观看| 成人欧美一区二区三区小说| 欧美日韩成人一区| 国产剧情在线观看一区二区| 久久日一线二线三线suv| av午夜精品一区二区三区| 亚洲五月六月丁香激情| 国产亚洲综合性久久久影院| 在线免费观看一区| 国产精品系列在线观看| 亚洲综合色成人| 精品久久国产字幕高潮| 91蝌蚪国产九色| 韩国午夜理伦三级不卡影院| 亚洲激情六月丁香| 精品久久久久久久久久久久包黑料 | 欧美大胆一级视频| 91一区一区三区| 精品一区二区三区免费播放| 亚洲免费三区一区二区| 欧美α欧美αv大片| 日本电影欧美片| 国产毛片精品国产一区二区三区| 洋洋成人永久网站入口| 欧美激情在线一区二区| 精品欧美久久久| 欧美欧美欧美欧美首页| 99久久夜色精品国产网站| 精品国产一区二区三区不卡 | 91精品久久久久久久99蜜桃| 白白色 亚洲乱淫| 黄网站免费久久| 亚洲成av人影院在线观看网| 国产精品入口麻豆九色| 欧美一级理论片| 欧美日韩三级在线| 91视频免费看| 成人免费福利片| 国产一区二区导航在线播放| 日韩激情一二三区| 亚洲成人自拍偷拍| 一区二区三区日韩欧美| 国产精品成人一区二区艾草| 国产性做久久久久久| 精品国产麻豆免费人成网站| 制服丝袜亚洲色图| 欧美美女一区二区三区| 日韩午夜三级在线| 91网站黄www| 豆国产96在线|亚洲| 国产主播一区二区| 精品一区二区免费在线观看| 日本女人一区二区三区| 五月激情综合婷婷| 亚洲一区二区在线免费观看视频| 亚洲私人黄色宅男| 成人免费小视频| 综合欧美一区二区三区| 日韩美女久久久| 亚洲女人的天堂| 一个色妞综合视频在线观看| 亚洲在线观看免费| 亚洲18色成人| 免费看日韩精品| 久久福利资源站| 精品一区中文字幕| 国产麻豆精品95视频| 国产一区二区精品久久| 福利电影一区二区| 97se亚洲国产综合自在线| 色域天天综合网| 欧美日韩精品二区第二页| 91精品国产全国免费观看| 欧美成人国产一区二区| 国产亲近乱来精品视频| 亚洲欧洲成人av每日更新| 亚洲国产视频a| 麻豆91在线播放免费| 国产精品99久| 色香蕉久久蜜桃| 欧美日韩色综合| 久久无码av三级| 亚洲麻豆国产自偷在线| 五月激情综合网| 国产福利91精品一区二区三区| 成人avav在线| 欧美色网站导航| 精品国产乱码久久久久久牛牛| 久久精品欧美一区二区三区不卡| 中文字幕在线观看不卡视频| 亚洲午夜免费福利视频| 久久精品国产一区二区三区免费看 | 91在线观看一区二区| 欧美图区在线视频| 日韩欧美一级在线播放| 国产精品高潮呻吟| 日韩黄色在线观看| 国产不卡在线一区| 欧美色倩网站大全免费| 久久精品视频网| 亚洲午夜久久久久中文字幕久| 狠狠色狠狠色综合| 91久久久免费一区二区| 欧美不卡一二三| 亚洲另类在线视频| 久久aⅴ国产欧美74aaa| 91丨国产丨九色丨pron| 日韩一区二区麻豆国产| 国产精品久久久久久久久动漫 | 亚洲欧洲日韩在线| 天天做天天摸天天爽国产一区| 国产精品一区二区在线观看不卡| 91精品福利在线| 久久久www成人免费无遮挡大片| 亚洲电影激情视频网站| 成人性色生活片免费看爆迷你毛片| 欧美日韩综合在线免费观看| 国产精品热久久久久夜色精品三区| 天天色 色综合| 99re66热这里只有精品3直播 | 国产天堂亚洲国产碰碰| 午夜精品久久久久久不卡8050| 国产91色综合久久免费分享| 欧美丰满美乳xxx高潮www| 亚洲欧美欧美一区二区三区| 国产精品一区二区久久不卡 | 欧美成人精品高清在线播放| 亚洲综合激情网| 成人黄色av网站在线| 久久综合久久久久88| 日本女优在线视频一区二区| 欧美怡红院视频| 中文字幕制服丝袜一区二区三区| 国内精品国产三级国产a久久| 欧美日韩亚洲丝袜制服| 亚洲免费观看视频| 成人av第一页| 国产精品欧美精品| 国产999精品久久| 国产人妖乱国产精品人妖| 精品一区二区三区免费| 欧美电视剧在线看免费| 日韩高清在线观看| 欧美喷水一区二区| 视频一区二区欧美| 欧美日韩日本视频| 亚洲丶国产丶欧美一区二区三区| 91国产视频在线观看| 亚洲欧洲中文日韩久久av乱码| av一二三不卡影片| 国产精品国产精品国产专区不蜜 | 国产精品私人自拍| 国产精品18久久久久久久久| 日韩一区二区三区观看| 日韩av电影免费观看高清完整版| 欧美三级视频在线|