mainmp3.asm

来自「IR Decoding source code」· 汇编 代码 · 共 260 行

ASM
260
字号
	.include "pbir.h"	.include "../lib/serial.h"	.module main_asmAUTOSTART = 0PAULMON = 0;---------------------------------------------------------;;Bits	.area	bits (ABS)irprefound:	.blkb	1;---------------------------------------------------------;;Data	.area	data (REL)bits:	.blkb	1irbitcnt:	.blkb	1irmesg:	.blkb	2ircode:	.blkb	1irtimersample:	.blkb	2stack:;---------------------------------------------------------;;Interrupt vectors	.area	vectors (REL);reset vector	ljmp	init;ext int0 vector (base + 3)	ljmp	pbir_isr	.blkb   5;timer0 vector (base + 0x0b)	reti	.blkb	7;ext int1 vector (base + 0x13)	reti		.blkb	7;timer1 vector (base + 0x1b)	reti	.blkb	7;serial vector (base + 0x23)	reti	.blkb	7;timer2 vector (base + 0x2b) 8052 ONLY	reti;---------------------------------------------------------;; Code	.area	code (REL); Paulmon header.if PAULMON.db     0xA5, 0xE5, 0xE0, 0xA5     ;signature bytes.if AUTOSTART.db     253, 0, 0, 0               ;id.else.db	254, 'T, 0, 0		   ;id (254=user installed command).endif.db     0, 0, 0, 0                 ;reserved.db     0, 0, 0, 0                 ;reserved.db     0, 0, 0, 0                 ;reserved.db     0, 0, 0, 0                 ;reserved.db     0, 0, 0, 0                 ;user defined.db     255, 255, 255, 255         ;length and checksum (255=unused).asciz  "Packard Bell Remote RX"	. = . + 9.endif ; PAULMON;---------------------------------------------------------;init::	clr	a	mov	ie, a		;all interrupts off	mov	ip, a	mov	psw, a	mov	tmod, a	mov	tcon, a	mov	sp, #stack	lcall	serial_init.if PAULMON;hello message	mov	dptr, #initstr	lcall	pstr.endif;timer 0	orl	tmod, #0x01	;16 bit counter	setb	tr0	lcall	pbir_init;interrupt 0	setb	p3.2		;enable int0 edge triggered	setb	it0	setb	ex0	lcall	pbir_start	setb	eamain_loop:	mov	a, #0xff	cjne	a, ircode, main_print	jnb	ri, main_loop	lcall	cin	lcall	cout	sjmp	main_loop;print received codemain_print:	xch	a, ircode	mov	b, a	anl	a, #0b00001111	cjne	a, #0x8, main_print_not8	mov	dptr, #lookup_lsb8	sjmp	main_print_lookupmain_print_not8:	cjne	a, #0x2, main_print_not2	mov	dptr, #lookup_lsb2	sjmp	main_print_lookupmain_print_not2:	jnz	main_print_unk	mov	dptr, #lookup_lsb0main_print_lookup:	mov	a, b	anl	a, #0xf0	xrl	a, #0xf0	;table is reversed (from hcll version)	swap	a	rl	a	mov	b, a	movc	a, @a+dptr	mov	r6, a	mov	a, b	inc	a	movc	a, @a+dptr	mov	r7, a	mov	dph, r6	mov	dpl, r7	lcall	pstr	sjmp	main_print_donemain_print_unk:	mov	a, b	lcall	phexmain_print_done:	lcall	newline	sjmp	main_loop;---------------------------------------------------------;; Strings & tables.if PAULMONinitstr:	.asciz "\r\nPackard Bell Infrared Remote receiver startup\r\n".endif	.IR0F:	.asciz	 "DISPLAY".IR17:	.asciz	 "IR3".IR1D:	.asciz	 "\nNXT_LIST\n".IR1F:	.asciz	 "\nPRV_LIST\n".IR2F:	.asciz	 "\nRIGHT\n".IR37:	.asciz	 "\nVOL-\n".IR3D:	.asciz	 "IR2".IR3F:	.asciz	 "IR8".IR47:	.asciz	 "\nPREVIOUS\n".IR4F:	.asciz	 "\nINC\n".IR57:	.asciz	 "IR9".IR5D:	.asciz	 "\nNXT_LIST\n".IR5F:	.asciz	 "\nPRV_LIST\n".IR6F:	.asciz	 "\nUP\n".IR77:	.asciz	 "\nPLAY\n".IR7D:	.asciz	 "IR5".IR7F:	.asciz	 "IR0".IR8F:	.asciz	 "\nENTER\n".IR97:	.asciz	 "IR6".IR9D:	.asciz	 "SRS".IR9F:	.asciz	 "PHONE".IRAF:	.asciz	 "\nDOWN\n".IRB7:	.asciz	 "\nVOL+\n".IRBD:	.asciz	 "IR1".IRBF:	.asciz	 "IR7".IRC7:	.asciz	 "\nNEXT\n".IRCF:	.asciz	 "\nDEC\n".IRD7:	.asciz	 "HASH".IRDD:	.asciz	 "MESSAGE".IRDF:	.asciz	 "HELP".IREF:	.asciz	 "\nLEFT\n".IRF7:	.asciz	 "\nRANDOM\n".IRFD:	.asciz	 "IR4".IRFF:	.asciz	 "STAR".IRERROR:.asciz	 "ERROR";; string lookup table;lookup_lsb8:	.word	 .IRERROR	.word	 .IR17	.word	 .IRERROR	.word	 .IR37	.word	 .IR47	.word	 .IR57	.word	 .IRERROR	.word	 .IR77	.word	 .IRERROR	.word	 .IR97	.word	 .IRERROR	.word	 .IRB7	.word	 .IRC7	.word	 .IRD7	.word	 .IRERROR	.word	 .IRF7lookup_lsb2:	.word	 .IRERROR	.word	 .IR1D	.word	 .IRERROR	.word	 .IR3D	.word	 .IRERROR	.word	 .IR5D	.word	 .IRERROR	.word	 .IR7D	.word	 .IRERROR	.word	 .IR9D	.word	 .IRERROR	.word	 .IRBD	.word	 .IRERROR	.word	 .IRDD	.word	 .IRERROR	.word	 .IRFDlookup_lsb0:	.word	 .IR0F	.word	 .IR1F	.word	 .IR2F	.word	 .IR3F	.word	 .IR4F	.word	 .IR5F	.word	 .IR6F	.word	 .IR7F	.word	 .IR8F	.word	 .IR9F	.word	 .IRAF	.word	 .IRBF	.word	 .IRCF	.word	 .IRDF	.word	 .IREF	.word	 .IRFF

⌨️ 快捷键说明

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