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

📄 keylcd.lss

📁 我学习AVR的代码例子
💻 LSS
📖 第 1 页 / 共 5 页
字号:

unsigned char printf_24(unsigned char x,unsigned char y, char *ptr)
{
     d88:	6f 92       	push	r6
     d8a:	7f 92       	push	r7
     d8c:	8f 92       	push	r8
     d8e:	9f 92       	push	r9
     d90:	af 92       	push	r10
     d92:	bf 92       	push	r11
     d94:	cf 92       	push	r12
     d96:	df 92       	push	r13
     d98:	ef 92       	push	r14
     d9a:	ff 92       	push	r15
     d9c:	0f 93       	push	r16
     d9e:	1f 93       	push	r17
     da0:	cf 93       	push	r28
     da2:	c8 2f       	mov	r28, r24
     da4:	e6 2e       	mov	r14, r22
     da6:	4a 01       	movw	r8, r20
    unsigned char c1,c2,i=0,j,k,uLen=0;
     da8:	66 24       	eor	r6, r6
     daa:	76 2c       	mov	r7, r6
    while (ptr[uLen]!=0) //探测字串长度
    {
        uLen++;
     dac:	fa 01       	movw	r30, r20
     dae:	80 81       	ld	r24, Z
     db0:	88 23       	and	r24, r24
     db2:	09 f4       	brne	.+2      	; 0xdb6
     db4:	a7 c0       	rjmp	.+334    	; 0xf04
     db6:	63 94       	inc	r6
     db8:	f4 01       	movw	r30, r8
     dba:	e6 0d       	add	r30, r6
     dbc:	f1 1d       	adc	r31, r1
     dbe:	80 81       	ld	r24, Z
     dc0:	88 23       	and	r24, r24
     dc2:	c9 f7       	brne	.-14     	; 0xdb6
    }	
    while(i<uLen)
    {
	    set_pos(x++,y);
		if(x>39) {x=0;y+=16;set_pos(x,y);}
    	c1 = ptr[i];
    	c2 = ptr[i+1];
        //ascii字符与汉字内码的区别在于128做分界,大于界线的为汉字码
    	if(c1 <=128)	// ASCII
      	{
            for(j=0;j<24;j++) //写16行
            {
				W_comm(0X42);    			// 写数据(命令)
				if (c1 >= 0x20)
				{
            	    W_code(pgm_read_byte(ASC+(c1-0x20)*16+j)); 
				}
				else
				{
					W_code(0);
				}
				set_pos(x,y+1+j);
            }	
        }
    	else    	// 中文
      	{
            for(j=0;j<sizeof(GB24_Index)/sizeof(GB24_Index[0]);j++)  	// 查找定位
            {
                if(c1 ==pgm_read_byte(GB24_Index+j*2) && c2 == pgm_read_byte(GB24_Index+j*2+1))
                {
                    break;
                }        				
            }
            for(k=0;k<24;k++)
            {
                set_pos(x,y+k);
				if(x>37) {x=0;y+=24;set_pos(x,y);}
				W_comm(0X42);      		// 写数据
				if(j < sizeof(GB24_Index)/sizeof(GB24_Index[0]))
				{
					W_code(pgm_read_byte(GB24_Msk+j*72+k*3));
					W_code(pgm_read_byte(GB24_Msk+j*72+k*3+1));
					W_code(pgm_read_byte(GB24_Msk+j*72+k*3+2));
				}
				else   		// 未找到该字
				{
					if(k < 8)
            	    {
                        W_code(0x00);
						W_code(0x00);
            	     }
					else
            	    {
						W_code(0xff);
						W_code(0xff);
            	    }
                }
			}
			x++;
			x++;
			i++;
      	};
    	i++;
     dc4:	76 14       	cp	r7, r6
     dc6:	08 f0       	brcs	.+2      	; 0xdca
     dc8:	9d c0       	rjmp	.+314    	; 0xf04
     dca:	8c 2f       	mov	r24, r28
     dcc:	cf 5f       	subi	r28, 0xFF	; 255
     dce:	6e 2d       	mov	r22, r14
     dd0:	0e 94 c5 05 	call	0xb8a
     dd4:	c8 32       	cpi	r28, 0x28	; 40
     dd6:	38 f0       	brcs	.+14     	; 0xde6
     dd8:	c0 e0       	ldi	r28, 0x00	; 0
     dda:	f0 e1       	ldi	r31, 0x10	; 16
     ddc:	ef 0e       	add	r14, r31
     dde:	6e 2d       	mov	r22, r14
     de0:	8c 2f       	mov	r24, r28
     de2:	0e 94 c5 05 	call	0xb8a
     de6:	f4 01       	movw	r30, r8
     de8:	e7 0d       	add	r30, r7
     dea:	f1 1d       	adc	r31, r1
     dec:	d0 80       	ld	r13, Z
     dee:	91 81       	ldd	r25, Z+1	; 0x01
     df0:	80 e8       	ldi	r24, 0x80	; 128
     df2:	8d 15       	cp	r24, r13
     df4:	38 f1       	brcs	.+78     	; 0xe44
     df6:	fe 2c       	mov	r15, r14
     df8:	f3 94       	inc	r15
     dfa:	00 e0       	ldi	r16, 0x00	; 0
     dfc:	10 e0       	ldi	r17, 0x00	; 0
     dfe:	77 e1       	ldi	r23, 0x17	; 23
     e00:	c7 2e       	mov	r12, r23
     e02:	82 e4       	ldi	r24, 0x42	; 66
     e04:	0e 94 c7 04 	call	0x98e
     e08:	9f e1       	ldi	r25, 0x1F	; 31
     e0a:	9d 15       	cp	r25, r13
     e0c:	68 f4       	brcc	.+26     	; 0xe28
     e0e:	ed 2d       	mov	r30, r13
     e10:	ff 27       	eor	r31, r31
     e12:	64 e0       	ldi	r22, 0x04	; 4
     e14:	ee 0f       	add	r30, r30
     e16:	ff 1f       	adc	r31, r31
     e18:	6a 95       	dec	r22
     e1a:	e1 f7       	brne	.-8      	; 0xe14
     e1c:	e0 0f       	add	r30, r16
     e1e:	f1 1f       	adc	r31, r17
     e20:	ec 55       	subi	r30, 0x5C	; 92
     e22:	ff 4f       	sbci	r31, 0xFF	; 255
     e24:	84 91       	lpm	r24, Z
     e26:	01 c0       	rjmp	.+2      	; 0xe2a
     e28:	80 e0       	ldi	r24, 0x00	; 0
     e2a:	0e 94 cf 04 	call	0x99e
     e2e:	6f 2d       	mov	r22, r15
     e30:	8c 2f       	mov	r24, r28
     e32:	0e 94 c5 05 	call	0xb8a
     e36:	ca 94       	dec	r12
     e38:	0f 5f       	subi	r16, 0xFF	; 255
     e3a:	1f 4f       	sbci	r17, 0xFF	; 255
     e3c:	f3 94       	inc	r15
     e3e:	c7 fe       	sbrs	r12, 7
     e40:	e0 cf       	rjmp	.-64     	; 0xe02
     e42:	5e c0       	rjmp	.+188    	; 0xf00
     e44:	cc 24       	eor	r12, r12
     e46:	45 ef       	ldi	r20, 0xF5	; 245
     e48:	51 e0       	ldi	r21, 0x01	; 1
     e4a:	9a 01       	movw	r18, r20
     e4c:	21 50       	subi	r18, 0x01	; 1
     e4e:	30 40       	sbci	r19, 0x00	; 0
     e50:	f9 01       	movw	r30, r18
     e52:	84 91       	lpm	r24, Z
     e54:	d8 16       	cp	r13, r24
     e56:	21 f4       	brne	.+8      	; 0xe60
     e58:	fa 01       	movw	r30, r20
     e5a:	84 91       	lpm	r24, Z
     e5c:	98 17       	cp	r25, r24
     e5e:	41 f0       	breq	.+16     	; 0xe70
     e60:	c3 94       	inc	r12
     e62:	2e 5f       	subi	r18, 0xFE	; 254
     e64:	3f 4f       	sbci	r19, 0xFF	; 255
     e66:	4e 5f       	subi	r20, 0xFE	; 254
     e68:	5f 4f       	sbci	r21, 0xFF	; 255
     e6a:	f4 e0       	ldi	r31, 0x04	; 4
     e6c:	fc 15       	cp	r31, r12
     e6e:	80 f7       	brcc	.-32     	; 0xe50
     e70:	ff 24       	eor	r15, r15
     e72:	aa 24       	eor	r10, r10
     e74:	bb 24       	eor	r11, r11
     e76:	8e 2d       	mov	r24, r14
     e78:	8f 0d       	add	r24, r15
     e7a:	68 2f       	mov	r22, r24
     e7c:	8c 2f       	mov	r24, r28
     e7e:	0e 94 c5 05 	call	0xb8a
     e82:	c6 32       	cpi	r28, 0x26	; 38
     e84:	38 f0       	brcs	.+14     	; 0xe94
     e86:	c0 e0       	ldi	r28, 0x00	; 0
     e88:	88 e1       	ldi	r24, 0x18	; 24
     e8a:	e8 0e       	add	r14, r24
     e8c:	6e 2d       	mov	r22, r14
     e8e:	8c 2f       	mov	r24, r28
     e90:	0e 94 c5 05 	call	0xb8a
     e94:	82 e4       	ldi	r24, 0x42	; 66
     e96:	0e 94 c7 04 	call	0x98e
     e9a:	94 e0       	ldi	r25, 0x04	; 4
     e9c:	9c 15       	cp	r25, r12
     e9e:	b8 f0       	brcs	.+46     	; 0xece
     ea0:	88 e4       	ldi	r24, 0x48	; 72
     ea2:	c8 9e       	mul	r12, r24
     ea4:	80 01       	movw	r16, r0
     ea6:	11 24       	eor	r1, r1
     ea8:	0a 0d       	add	r16, r10
     eaa:	1b 1d       	adc	r17, r11
     eac:	f8 01       	movw	r30, r16
     eae:	ec 59       	subi	r30, 0x9C	; 156
     eb0:	fe 4f       	sbci	r31, 0xFE	; 254
     eb2:	84 91       	lpm	r24, Z
     eb4:	0e 94 cf 04 	call	0x99e
     eb8:	f8 01       	movw	r30, r16
     eba:	eb 59       	subi	r30, 0x9B	; 155
     ebc:	fe 4f       	sbci	r31, 0xFE	; 254
     ebe:	84 91       	lpm	r24, Z
     ec0:	0e 94 cf 04 	call	0x99e
     ec4:	0a 59       	subi	r16, 0x9A	; 154
     ec6:	1e 4f       	sbci	r17, 0xFE	; 254
     ec8:	f8 01       	movw	r30, r16
     eca:	84 91       	lpm	r24, Z
     ecc:	0c c0       	rjmp	.+24     	; 0xee6
     ece:	f7 e0       	ldi	r31, 0x07	; 7
     ed0:	ff 15       	cp	r31, r15
     ed2:	28 f0       	brcs	.+10     	; 0xede
     ed4:	80 e0       	ldi	r24, 0x00	; 0
     ed6:	0e 94 cf 04 	call	0x99e
     eda:	80 e0       	ldi	r24, 0x00	; 0
     edc:	04 c0       	rjmp	.+8      	; 0xee6
     ede:	8f ef       	ldi	r24, 0xFF	; 255
     ee0:	0e 94 cf 04 	call	0x99e
     ee4:	8f ef       	ldi	r24, 0xFF	; 255
     ee6:	0e 94 cf 04 	call	0x99e
     eea:	f3 94       	inc	r15
     eec:	83 e0       	ldi	r24, 0x03	; 3
     eee:	90 e0       	ldi	r25, 0x00	; 0
     ef0:	a8 0e       	add	r10, r24
     ef2:	b9 1e       	adc	r11, r25
     ef4:	97 e1       	ldi	r25, 0x17	; 23
     ef6:	9f 15       	cp	r25, r15
     ef8:	08 f0       	brcs	.+2      	; 0xefc
     efa:	bd cf       	rjmp	.-134    	; 0xe76
     efc:	ce 5f       	subi	r28, 0xFE	; 254
     efe:	73 94       	inc	r7
     f00:	73 94       	inc	r7
     f02:	60 cf       	rjmp	.-320    	; 0xdc4
    }
    return uLen;        //返回字串长度,汉字按2字节计算
} 
     f04:	86 2d       	mov	r24, r6
     f06:	99 27       	eor	r25, r25
     f08:	cf 91       	pop	r28
     f0a:	1f 91       	pop	r17
     f0c:	0f 91       	pop	r16
     f0e:	ff 90       	pop	r15
     f10:	ef 90       	pop	r14
     f12:	df 90       	pop	r13
     f14:	cf 90       	pop	r12
     f16:	bf 90       	pop	r11
     f18:	af 90       	pop	r10
     f1a:	9f 90       	pop	r9
     f1c:	8f 90       	pop	r8
     f1e:	7f 90       	pop	r7
     f20:	6f 90       	pop	r6
     f22:	08 95       	ret

00000f24 <point>:

//再指定坐标(x,y)画点
void point(WORD px,WORD py,BYTE dshow)
{
     f24:	ef 92       	push	r14
     f26:	ff 92       	push	r15
     f28:	0f 93       	push	r16
     f2a:	1f 93       	push	r17
     f2c:	cf 93       	push	r28
     f2e:	df 93       	push	r29
     f30:	cd b7       	in	r28, 0x3d	; 61
     f32:	de b7       	in	r29, 0x3e	; 62
     f34:	22 97       	sbiw	r28, 0x02	; 2
     f36:	0f b6       	in	r0, 0x3f	; 63
     f38:	f8 94       	cli
     f3a:	de bf       	out	0x3e, r29	; 62
     f3c:	0f be       	out	0x3f, r0	; 63
     f3e:	cd bf       	out	0x3d, r28	; 61
     f40:	9c 01       	movw	r18, r24
     f42:	7b 01       	movw	r14, r22
     f44:	14 2f       	mov	r17, r20
  BYTE px1;
  volatile BYTE temp,temp1;
  px1=px/8;
     f46:	ac 01       	movw	r20, r24
     f48:	e3 e0       	ldi	r30, 0x03	; 3
     f4a:	56 95       	lsr	r21
     f4c:	47 95       	ror	r20
     f4e:	ea 95       	dec	r30
     f50:	e1 f7       	brne	.-8      	; 0xf4a
     f52:	04 2f       	mov	r16, r20
  px=px & 0x0007;
     f54:	27 70       	andi	r18, 0x07	; 7
     f56:	30 70       	andi	r19, 0x00	; 0
  temp =(BYTE)(7-px);
     f58:	87 e0       	ldi	r24, 0x07	; 7
     f5a:	82 1b       	sub	r24, r18
     f5c:	89 83       	std	Y+1, r24	; 0x01
  temp = 1<<temp;
     f5e:	29 81       	ldd	r18, Y+1	; 0x01
     f60:	81 e0       	ldi	r24, 0x01	; 1
     f62:	90 e0       	ldi	r25, 0x00	; 0
     f64:	02 c0       	rjmp	.+4      	; 0xf6a
     f66:	88 0f       	add	r24, r24
     f68:	99 1f       	adc	r25, r25
     f6a:	2a 95       	dec	r18
     f6c:	e2 f7       	brpl	.-8      	; 0xf66
     f6e:	89 83       	std	Y+1, r24	; 0x01
  set_pos(px1,py);
     f70:	84 2f       	mov	r24, r20
     f72:	0e 94 c5 05 	call	0xb8a
  temp1=r_data();
     f76:	0e 94 73 05 	call	0xae6
     f7a:	8a 83       	std	Y+2, r24	; 0x02
  if(dshow)
     f7c:	11 23       	and	r17, r17
     f7e:	21 f0       	breq	.+8      	; 0xf88
    temp|=temp1;
     f80:	89 81       	ldd	r24, Y+1	; 0x01
     f82:	9a 81       	ldd	r25, Y+2	; 0x02
     f84:	89 2b       	or	r24, r25
     f86:	04 c0       	rjmp	.+8      	; 0xf90
  else
    temp=(~temp)&temp1;
     f88:	89 81       	ldd	r24, Y+1	; 0x01
     f8a:	80 95       	com	r24
     f8c:	9a 81       	ldd	r25, Y+2	; 0x02
     f8e:	89 23       	and	r24, r25
     f90:	89 83       	std	Y+1, r24	; 0x01
  set_pos(px1,py);
     f92:	6e 2d       	mov	r22, r14
     f94:	80 2f       	mov	r24, r16
     f96:	0e 94 c5 05 	call	0xb8a
  W_comm(0X42);
     f9a:	82 e4       	ldi	r24, 0x42	; 66
     f9c:	0e 94 c7 04 	call	0x98e
  W_code(temp);  //在屏上写一点
     fa0:	89 81       	ldd	r24, Y+1	; 0x01
     fa2:	0e 94 cf 04 	call	0x99e
     fa6:	22 96       	adiw	r28, 0x02	; 2
     fa8:	0f b6       	in	r0, 0x3f	; 63
     faa:	f8 94       	cli
     fac:	de bf       	out	0x3e, r29	; 62
     fae:	0f be       	out	0x3f, r0	; 63
     fb0:	cd bf       	out	0x3d, r28	; 61
     fb2:	df 91       	pop	r29
     fb4:	cf 91       	pop	r28
     fb6:	1f 91       	pop	r17
     fb8:	0f 91       	pop	r16
     fba:	ff 90       	pop	r15
     fbc:	ef 90       	pop	r14
     fbe:	08 95       	ret

00000fc0 <Line>:
}

void Line(int x1, int y1, int x2, int y2, BYTE show) 
{
     fc0:	2f 92       	push	r2
     fc2:	3f 92       	push	r3
     fc4:	4f 92       	push	r4
     fc6:	5f 92       	push	r5
     fc8:	6f 92       	push	r6
     fca:	7f 92       	push	r7

⌨️ 快捷键说明

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