⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extra.asm

📁 MCS51系列单片机的汇编器
💻 ASM
📖 第 1 页 / 共 4 页
字号:
	cpl	a	jz	cmdlf2	acall	invert_it	ajmp	maincmdlf2:	mov	a, r6	cpl	a	anl	a, #11110000b	jz	cmd_left_scroll	mov	a, #48	acall	cursor_right	mov	a, #1	acall	cursor_up	acall	invert_it	ajmp	maincmd_left_scroll:	acall	redraw_data	ajmp	maincmd_right:	acall	blank_it	mov	a, #3	acall	cursor_right	mov	dpl, r6	mov	dph, r7	inc	dptr	mov	r6, dpl	mov	r7, dph	mov	a, r6	anl	a, #00001111b	jz	cmdrt2	acall	invert_it	ajmp	maincmdrt2:	mov	a, r6	anl	a, #11110000b	jz	cmd_right_scroll	mov	a, #48	acall	cursor_left	mov	a, #1	acall	cursor_down	acall	invert_it	ajmp	maincmd_right_scroll:	acall	redraw_data	ajmp	mainspace:	mov	a, #' '	ajmp	cout_hh;register usage:; R4,    Flags:;         bit0: 0=display CODE memory, 1=display DATA memory;         bit1: 0=editing disabled, 1=editing enabled;         bit2: 0=editing in hex, 1=editing in ascii;	  bit3: 0=normal, 1=in middle of hex entry (value in r5); R6/R7, current memory location;redraw:        mov     dptr, #str_cl		;clear screen        acall   pstr_hh	acall	print_title_line	acall	newline_hh	acall	print_addr_line	acall	newline_hh	acall	print_dash_line        acall   newline_hh	mov	a, #16	acall	cursor_down        acall   print_dash_line        acall   newline_hh        acall   print_commandsredraw_data:	acall	cursor_home	mov	a, #2	acall	cursor_down	;compute first byte address to display on the screen	mov	dpl, #0	mov	dph, r7	;now display the data	mov	r0, #16rd2:	acall	newline_hh	lcall	phex16	mov	a, #':'	acall	cout_hh	mov	r2, dpl	mov	r3, dphrd3:	acall	space	acall	read_dptr	acall	phex_hh	inc	dptr	mov	a, dpl	anl	a, #00001111b	jnz	rd3	mov	dpl, r2	mov	dph, r3	acall	space	acall	space	acall	spacerd4:	acall	read_dptr	acall	ascii_only	acall	cout_hh	inc	dptr	mov	a, dpl	anl	a, #00001111b	jnz	rd4	djnz	r0, rd2redraw_cursor:	acall	cursor_home	mov	a, r6	swap	a	anl	a, #00001111b	add	a, #3	acall	cursor_down	;make the ascii character inverse	mov	a, r6	anl	a, #00001111b	add	a, #56	acall	cursor_right	acall	inverse_on	acall	read_r6r7	acall	ascii_only	acall	cout_hh	acall	inverse_off	;now make the hex value inverse	mov	a, r6	anl	a, #00001111b	rl	a	cpl	a	add	a, #52	acall	cursor_left	acall	inverse_on	acall	read_r6r7	acall	phex_hh	ajmp	inverse_offblank_it:	mov	a, r6	anl	a, #00001111b	rl	a	cpl	a	add	a, #49	acall	cursor_right	acall	read_r6r7	acall	ascii_only	acall	cout_hh	mov	a, r6	anl	a, #00001111b	rl	a	cpl	a	add	a, #52	acall	cursor_left	acall	read_r6r7	ajmp	phex_hhinvert_it:        mov     a, r6        anl     a, #00001111b        rl      a        cpl     a        add     a, #49        acall   cursor_right        acall   read_r6r7        acall   ascii_only	acall	inverse_on        acall   cout_hh	acall	inverse_off        mov     a, r6        anl     a, #00001111b        rl      a        cpl     a        add     a, #52        acall   cursor_left        acall   read_r6r7	acall	inverse_on        acall   phex_hh	ajmp	inverse_offquit:	mov	a, r6	anl	a, #11110000b	swap	a	cpl	a	add	a, #19	acall	cursor_down	ajmp	newline_hhascii_only:        anl     a, #01111111b   ;avoid unprintable characters	cjne	a, #127, aonly2	mov	a, #' '	retaonly2: clr     c        subb    a, #32        jnc     aonly3          ;avoid control characters        mov     a, #(' ' - 32)aonly3: add     a, #32	retread_dptr:	mov	a, r4	jb	acc.0, rddptr2	clr	a	movc	a, @a+dptr	retrddptr2:movx	a, @dptr	retread_r6r7:	push	dph	push	dpl	mov	dph, r7	mov	dpl, r6	mov	a, r4	jb	acc.3, rdr6r7d	jb	acc.0, rdr6r7b	clr	a	movc	a, @a+dptr	sjmp	rdr6r7crdr6r7b:movx	a, @dptrrdr6r7c:pop	dpl	pop	dph	retrdr6r7d:mov	a, r5	sjmp	rdr6r7c.equ	esc_char, 27cursor_home:	acall	term_esc	mov	a, #'H'	ajmp	cout_hhcursor_down:	;acc is # of lines to move down	acall	term_esc	acall	pint_hh	mov	a, #'B'	ajmp	cout_hhcursor_up:	;acc is # of lines to move up	acall	term_esc	acall	pint_hh	mov	a, #'A'	ajmp	cout_hhcursor_left:	;acc is # of characters to move left	acall	term_esc	acall	pint_hh	mov	a, #'D'	ajmp	cout_hhcursor_right:	;acc is # of characters to move right	acall	term_esc	acall	pint_hh	mov	a, #'C'	ajmp	cout_hhinverse_on:	mov	dptr, #str_so	ajmp	pstr_hhstr_so:	.db	esc_char, "[0;7m", 0inverse_off:	mov	dptr, #str_se	ajmp	pstr_hhstr_se:	.db	esc_char, "[0m", 0term_esc:	push	acc	mov	a, #esc_char	acall	cout_hh	mov	a, #'['	acall	cout_hh	pop	acc	ret	print_addr_line:	mov	dptr, #str_addr	acall	pstr_hh	mov	r0, #0paddrl: acall	space	mov	a, #'+'	acall	cout_hh	mov	a, r0	lcall	phex1	inc	r0	cjne	r0, #16, paddrl	mov	dptr, #str_ascii_equiv	ajmp	pstr_hhprint_dash_line:	mov	r0, #72pdashl: mov	a, #'-'	acall	cout_hh	djnz	r0, pdashl	retprint_title_line:	mov	a, r4	jb	acc.0, ptitle2	mov	dptr, #str_code	sjmp	ptitle3ptitle2:mov	dptr, #str_dataptitle3:acall	pstr_hh	mov	r0, #8ptitlel:acall	space	djnz	r0, ptitlel	mov	dptr, #str_title	ajmp	pcstr_hherase_commands:        acall   cursor_home        mov     a, #20        acall   cursor_down        mov     r2, #72ercmd2: acall   space        djnz    r2, ercmd2	mov	a, #72	ajmp	cursor_left; R4,    Flags:;         bit0: 0=display CODE memory, 1=display DATA memory;         bit1: 0=editing disabled, 1=editing enabled;         bit2: 0=editing in hex, 1=editing in ascii;         bit3: 0=normal, 1=in middle of hex entry (value in r5)print_commands:        mov     a, r4        jnb     acc.1, pcmd_no_edit	mov	dptr, #str_cmd3	jb	acc.2, pcmd_ascii	mov	dptr, #str_cmd4pcmd_ascii:	acall	pstr_hh	mov	dptr, #str_cmd5	acall	pstr_hh	sjmp	pcmd_finishpcmd_no_edit:	mov     dptr, #str_cmd2	acall   pstr_hhpcmd_finish:        mov     dptr, #str_cmd1        ajmp    pstr_hhstr_cmd1: .db "  ^G=Goto  ^C=Code  ^D=Data  ^L=Redraw  ^Q=Quit", 0str_cmd2: .db "^E-Edit",0str_cmd3: .db "^A=", esc_char, "[0;7m", "ASCII", esc_char, "[0m", "  ^X=Hex", 0str_cmd4: .db "^A=ASCII  ^X=", esc_char, "[0;7m", "Hex", esc_char, "[0m", 0str_cmd5: .db "  ^F=Fill",0str_cl:	.db	esc_char, "[H", esc_char, "[2J", 0str_addr: .db "ADDR:",0str_ascii_equiv: .db	"   ASCII EQUIVILANT",0str_title: .db	"8051",31,154,31,131,31,216,"or,",31,248,31,254,", 1996",0str_code: .db "CODE",0str_data: .db "DATA",0cout_hh:ljmp	coutphex_hh:ljmp	phexpstr_hh:ljmp	pstrnewline_hh:ljmp	newlinepcstr_hh:ljmp	pcstrpint_hh:ljmp	pint;---------------------------------------------------------;;                                                         ;;                    single step strings                  ;;                                                         ;;---------------------------------------------------------;           prompt4:.db     "), or <ESC> to exit: ",0 prompt8:.db     13,31,136,128,131,129," (",0 abort:  .db     " Command Aborted.",13,10,0sserr1: .db     13,161,197," connect INT1 (pin 13) low"        .db     128,186,207,204,13,0sserr2:	.db	148,"2",179,199,174,129," 0013",13,0sserr3:	.db	31,184,179,255,165," vector",174," ",0ssmsg:  .db     13,"Now",134,"ning",166,207,204," mode:  "        .db     "<RET>=",204,", ?= Help",13,13,0sskip1: .db     "Skipping Instruction-> ",0ssdmps1:.db     13,10,"Loc:  Int RAM Memory Contents",13,10,0chaccs1:.db     "New Acc Value: ",0help5txt:.db	13        .db     31,207,31,204,31,158,":",13        .db     "<RET> ",134,212,246,13        .db     " <SP> ",134,212,246,13        .db     " '?'  ",255,142,215,13	.db	" '.'  ",255,196,253,"s",13        .db     " 'R'  ",255," special function",196,"s",13        .db     " 'H'  ",132,219,192,146,13        .db     " 'S'  ",252,212,246,13        .db     " 'A'  ",240,162," Acc value",13	.db     " 'Q'  ",200,207,204,13,14squit:	.db	"Quit",13,10,0ssnames:.db	"  ACC B C DPTR  R0 R1 R2 R3 R4 R5 R6 R7  SP"	.db	"   Addr  Instruction",13,10,0;---------------------------------------------------------;;                                                         ;;                    disassembler data                    ;;                                                         ;;---------------------------------------------------------;mnu_tbl:.db     "ACAL",'L'+128        .db     0        .db     "AD",'D'+128        .db     0        .db     "ADD",'C'+128        .db     "AJM",'P'+128        .db     "AN",'L'+128        .db     "CJN",'E'+128        .db     "CL",'R'+128        .db     "CP",'L'+128        .db     "D",'A'+128         .db     "DE",'C'+128        .db     "DI",'V'+128        .db     "DJN",'Z'+128        .db     "IN",'C'+128        .db     "J",'B'+128        .db     "JB",'C'+128        .db     "J",'C'+128        .db     "JM",'P'+128        .db     "JN",'B'+128        .db     "JN",'C'+128        .db     "JN",'Z'+128        .db     "J",'Z'+128        .db     "LCAL",'L'+128        .db     "LJM",'P'+128        .db     "MO",'V'+128        .db     "MOV",'C'+128        .db     "MOV",'X'+128        .db     "MU",'L'+128        .db     "NO",'P'+128        .db     "OR",'L'+128        .db     "PO",'P'+128        .db     "PUS",'H'+128        .db     "RE",'T'+128        .db     "RET",'I'+128        .db     "R",'L'+128        .db     "RL",'C'+128        .db     "R",'R'+128        .db     "RR",'C'+128        .db     "SET",'B'+128        .db     "SJM",'P'+128        .db     "SUB",'B'+128        .db     "SWA",'P'+128        .db     "XC",'H'+128        .db     "XCH",'D'+128        .db     "XR",'L'+128        .db     "??",'?'+128bitmnu: .db     'P','0'+128        .db     "TCO",'N'+128        .db     'P','1'+128        .db     "SCO",'N'+128        .db     'P','2'+128        .db     'I','E'+128        .db     'P','3'+128        .db     'I','P'+128        .db     'C','0'+128        .db     "T2CO",'N'+128        .db     "PS",'W'+128        .db     'D','8'+128        .db     "AC",'C'+128        .db     'E'+'8'+128        .db     'B'+128        .db     'F'+'8'+128

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -