Liby's Blog

 汝鬼耶,抑人耶?

Archive for the ‘学习’ tag

留个记号

without comments

1
2
3
4
5
6
7
8
9
10
#!/bin/bash
a=$1
b=$2
echo "$a,$b"
if [ $a -gt $b ]
then
echo "$a>$b"
else
echo "$b>$a"
fi
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
folder=$PWD
echo "$folder"
count=0
for files in *
do
if
[ -f "$files" ]
then
count=`expr $count + 1`
fi
done
echo $count
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
echo -n "input number:"
read num
nbak=$num
i=0
reverse=""
while [ $nbak -ne 0 ]
do
i=$[ $nbak % 10]
nbak=$[ $nbak / 10]
reverse="$reverse$i"
done
echo "$reverse"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
if [ $1 = "" ] || [ $2 =  ""]
then
echo "enter parameter"
exit 1
fi
source=$PWD/$1
desert=$2
echo "$source move to $desert"
if [ -e $desert$1 ]
then
until [ !-e $desert$1 ]
do
echo "files has been deleted"
done
else
mv $PWD/$1 $desert/$1
fi

Written by liby

四月 11th, 2012 at 3:10 下午

Posted in 技事巧事

Tagged with ,

留个记号

without comments

 时隔这么久,再次做个小记号。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <reg52.h>
#define uchar unsigned char
 
sbit addr0=P1^4;
sbit addr1=P1^5;
sbit addr2=P1^6;
sbit addr3=P1^7;
 
uchar code scan[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};  
uchar code words[]={0xFF,0xF7,0x81,0xB5,0x81,0xF7,0xF7,0xFF};
uchar i,j,t;
 
void delay(uchar i)
{
	 for(i;i>0;i--);
}
 
void time50us() interrupt 1
{
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	t++;
}
 
void main()
{
	EA=0;
	TMOD=0x01;
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	ET0=1;
	EA=1;
	TR0=1;
	while(1)
	{
		if(t==10)
		{
			t=0;
			j++;
		}
		for(i=0;i<8;i++)
		{
		  addr0=0;
		  addr1=0;
		  addr2=0;
		  addr3=0;
		  P0=0xff;
		  addr3=1;
		  addr3=0;
		  addr0=1;
		  addr1=0;
		  addr2=0;
		  P0=words[(i+j)%8];
		  addr3=1;
		  addr3=0;
		  addr0=0;
		  addr1=0;
		  addr2=0;
		  P0=scan[i];
		  addr3=1;
		  addr3=0;
		  delay(20);
		}
	}
}

Written by liby

十月 16th, 2011 at 10:08 下午

Posted in 杂事杂说

Tagged with , ,

留个记号

with 2 comments

  这么长时间也没有做下真正的记号,最好的复习应该就是做笔记了。今天做个小笔记吧。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
assume cs:code,ds:data
data segment
db	'welcome to masm!'
db	02h,24h,71h
data ends
code segment
start:	mov ax,data
	mov ds,ax
	mov ax,0b872h ;显示位置
	mov es,ax
	mov bp,10h ;颜色02h的位置
 
	mov cx,3	
s:	push cx
	mov di,0
 
	mov cx,16
s1:	mov dl,ds:[di]	;将字符
	mov es:[si],dl	;复制到低字节
	mov dh,ds:[bp]	;将颜色
	mov es:[si+1],dh;复制到高字节
	inc di	;下一字符
	add si,2;加2,颜色为奇地址
	loop s1
 
	add si,80h ;160个字节-32字节跳转到下一行
	add bp,1
	pop cx	
	loop s
 
	mov ax,4c00h 
	int 21h 
 
code ends 
end start

  最后忘记写程序退出返回,导致查了很多遍都没有找到问题所在,以后得记清楚了。
  
  坚定不移的信念是成功的钥匙!

Written by liby

十一月 6th, 2010 at 3:07 下午

Posted in 技事巧事

Tagged with , ,