📄 main.s
字号:
.module main.c
.area lit(rom, con, rel)
_you1::
.byte 0,16
.byte 16,16
.byte 16,16
.byte 255,16
.byte 16,242
.byte 20,28
.byte 16,16
.byte 16,0
.dbfile C:\DOCUME~1\zhuji\桌面\新建文~2/chinese.h
.dbsym e you1 _you1 A[16:16]kc
_you2::
.byte 0,128
.byte 64,32
.byte 24,6
.byte 1,0
.byte 0,63
.byte 64,64
.byte 64,64
.byte 'x,0
.dbsym e you2 _you2 A[16:16]kc
_xuan1::
.byte 64,64
.byte 'B,204
.byte 0,'P
.byte 'N,200
.byte 'H,127
.byte 200,'H
.byte 'H,64
.byte 0,0
.dbsym e xuan1 _xuan1 A[16:16]kc
_xuan2::
.byte 0,64
.byte 32,31
.byte 32,'H
.byte 'F,'A
.byte 64,64
.byte 'G,'H
.byte 'H,'N
.byte 64,0
.dbsym e xuan2 _xuan2 A[16:16]kc
_ze1::
.byte 8,8
.byte 255,136
.byte 'H,8
.byte 'B,'F
.byte 42,210
.byte 42,'F
.byte 'B,128
.byte 128,0
.dbsym e ze1 _ze1 A[16:16]kc
_ze2::
.byte 'B,129
.byte 127,0
.byte 0,8
.byte 9,9
.byte 9,255
.byte 9,9
.byte 9,8
.byte 8,0
.dbsym e ze2 _ze2 A[16:16]kc
_gong1::
.byte 0,4
.byte 4,4
.byte 252,4
.byte 20,20
.byte 16,144
.byte 127,16
.byte 16,240
.byte 0,0
.dbsym e gong1 _gong1 A[16:16]kc
_gong2::
.byte 4,12
.byte 4,4
.byte 3,'B
.byte 34,17
.byte 12,35
.byte 32,96
.byte 32,31
.byte 0,0
.dbsym e gong2 _gong2 A[16:16]kc
_hu1::
.byte 0,0
.byte 248,8
.byte 'H,'H
.byte 'H,255
.byte 170,170
.byte 170,138
.byte 216,8
.byte 0,0
.dbsym e hu1 _hu1 A[16:16]kc
_hu2::
.byte 128,96
.byte 31,128
.byte 64,62
.byte 2,2
.byte 2,62
.byte 64,64
.byte 64,'x
.byte 32,0
.dbsym e hu2 _hu2 A[16:16]kc
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\zhuji\桌面\新建文~2/chinese.h
.dbfile C:\DOCUME~1\zhuji\桌面\新建文~2\main.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 18
; // Project :12864 LCD Display
; // ICC-AVR application builder :2008-3-23
; // Target : M128
; // Crystal: 8.0000Mhz
; // Description : display chinese
; // 纵向取模方式 16*16字体
;
; #include <iom128v.h>
; #include <macros.h>
; #include "chinese.h"
; #include "main.h"
; typedef unsigned char uchar;
; typedef unsigned int uint;
;
; unsigned char flag;
;
; void port_init(void)
; {
.dbline 20
; //访问外部ram的总线端口
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 21
; DDRA = 0x00;
out 0x1a,R2
.dbline 22
; PORTC = 0x00;
out 0x15,R2
.dbline 23
; DDRC = 0xFF;
ldi R24,255
out 0x14,R24
.dbline -2
.dbline 24
; }
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e check_busy _check_busy fV
; temp -> R20
; cs -> R16
.even
_check_busy::
xcall push_gset1
.dbline -1
.dbline 27
;
; void check_busy(uchar cs) //查忙函数
; {
xjmp L4
L3:
.dbline 30
; uchar temp;
; while(temp)
; {
.dbline 31
; if(cs)
tst R16
breq L6
.dbline 32
; temp=R_staus&0X80; //将忙状态读到temp中进行确定
lds R20,8197
andi R20,128
xjmp L7
L6:
.dbline 34
; else
; temp=L_staus&0X80;
lds R20,8201
andi R20,128
L7:
.dbline 35
L4:
.dbline 29
tst R20
brne L3
.dbline -2
.dbline 36
; }
; }
L2:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r temp 20 c
.dbsym r cs 16 c
.dbend
.dbfunc e LCD_Clean _LCD_Clean fV
; page -> R20
; y -> R22
.even
_LCD_Clean::
xcall push_gset2
.dbline -1
.dbline 39
;
; void LCD_Clean(void)
; {
.dbline 40
; unsigned char page=0,y; //定义表示页和列的局部变量
clr R20
.dbline 42
;
; for(page=0;page<8;page++)
xjmp L12
L9:
.dbline 43
; {
.dbline 45
; //LCD左半屏的操作
; check_busy(0);
clr R16
xcall _check_busy
.dbline 46
; L_command=LCD_PAGE+page; //设置LCD左半屏页地址
mov R24,R20
subi R24,72 ; addi 184
sts 8200,R24
.dbline 47
; check_busy(0);
clr R16
xcall _check_busy
.dbline 48
; L_command=LCD_Y;
ldi R24,64
sts 8200,R24
.dbline 50
; //LCD右半屏的操作
; check_busy(1);
ldi R16,1
xcall _check_busy
.dbline 51
; R_command=LCD_PAGE+page; //设置LCD右半屏页地址
mov R24,R20
subi R24,72 ; addi 184
sts 8196,R24
.dbline 52
; check_busy(1);
ldi R16,1
xcall _check_busy
.dbline 53
; R_command=LCD_Y;
ldi R24,64
sts 8196,R24
.dbline 55
;
; for(y=0;y<64;y++)
clr R22
xjmp L16
L13:
.dbline 56
.dbline 57
clr R2
sts 8202,R2
.dbline 58
sts 8198,R2
.dbline 59
L14:
.dbline 55
inc R22
L16:
.dbline 55
cpi R22,64
brlo L13
.dbline 60
L10:
.dbline 42
inc R20
L12:
.dbline 42
cpi R20,8
brlo L9
.dbline -2
.dbline 61
; {
; L_data=0x00;
; R_data=0x00;
; }
; }
; }
L8:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r page 20 c
.dbsym r y 22 c
.dbend
.dbfunc e LCD_Init _LCD_Init fV
.even
_LCD_Init::
.dbline -1
.dbline 64
;
; void LCD_Init(void) //LCD初始化子函数
; {
.dbline 66
; /*首先关闭12864的显示*/
; check_busy(0); //LCD左半屏正在工作,等待......
clr R16
xcall _check_busy
.dbline 67
; L_command=LCD_OFF; //先关闭LCD左半屏的显示
ldi R24,62
sts 8200,R24
.dbline 68
; check_busy(1); //LCD右半屏正在工作,等待......
ldi R16,1
xcall _check_busy
.dbline 69
; R_command=LCD_OFF; //先关闭LCD右半屏的显示
ldi R24,62
sts 8196,R24
.dbline 72
;
; /*开启12864的显示*/
; check_busy(0);
clr R16
xcall _check_busy
.dbline 73
; L_command=LCD_ON; //打开LCD左半屏的显示
ldi R24,63
sts 8200,R24
.dbline 74
; check_busy(1);
ldi R16,1
xcall _check_busy
.dbline 75
; R_command=LCD_ON; //打开LCD右半屏的显示
ldi R24,63
sts 8196,R24
.dbline 78
;
; /*设置LCD显示的起始行*/
; check_busy(0);
clr R16
xcall _check_busy
.dbline 79
; L_command=LCD_X; //LCD左半屏起始行为0
ldi R24,192
sts 8200,R24
.dbline 80
; check_busy(1);
ldi R16,1
xcall _check_busy
.dbline 81
; R_command=LCD_X; //LCD右半屏起始行为0
ldi R24,192
sts 8196,R24
.dbline -2
.dbline 82
; }
L17:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 85
;
; void init_devices(void)
; {
.dbline 86
; XMCRA = 0x00; //外部存储器控制
clr R2
sts 109,R2
.dbline 87
; XMCRB = (1<<XMM2)|(1<<XMM1)|(1<<XMM0); //外存储高位地址屏蔽,释放端口C
ldi R24,7
sts 108,R24
.dbline 88
; port_init();
xcall _port_init
.dbline 89
; MCUCR = 0x80; //外部SRAM使能
ldi R24,128
out 0x35,R24
.dbline -2
.dbline 90
; }
L18:
.dbline 0 ; func end
ret
.dbend
.dbfunc e write_chineseH _write_chineseH fV
; i -> R20
; datas -> R22,R23
; y -> y+4
; page -> R18
; cs -> R16
.even
_write_chineseH::
xcall push_gset2
ldd R22,y+6
ldd R23,y+7
.dbline -1
.dbline 98
;
;
; /*******************cs为左右屏选,page为页数选择(0~15)********************************
; *******************y为水平位置选择(0~3),datas指针指向汉字存储的数组地址 ********************/
;
;
; void write_chineseH(uchar cs,uchar page,uchar y,const unsigned char *datas) //上半部分显示
; {
.dbline 100
; uchar i;
; R_command=LCD_PAGE+page; //设置LCD右半屏页地址
mov R24,R18
subi R24,72 ; addi 184
sts 8196,R24
.dbline 101
; L_command=LCD_PAGE+page; //设置LCD左半屏页地址
mov R24,R18
subi R24,72 ; addi 184
sts 8200,R24
.dbline 102
; R_command=LCD_Y+y*16; //设置水平显示位置
ldi R24,16
ldd R0,y+4
mul R24,R0
mov R24,R0
subi R24,192 ; addi 64
sts 8196,R24
.dbline 103
; L_command=LCD_Y+y*16;
ldi R24,16
ldd R0,y+4
mul R24,R0
mov R24,R0
subi R24,192 ; addi 64
sts 8200,R24
.dbline 104
; for(i=0;i<16;i++)
clr R20
xjmp L23
L20:
.dbline 105
; {
.dbline 106
; if(cs) R_data=*datas; //右半屏显示
tst R16
breq L24
.dbline 106
movw R30,R22
lpm R30,Z
sts 8198,R30
xjmp L25
L24:
.dbline 107
; else L_data=*datas; //左半屏显示
movw R30,R22
lpm R30,Z
sts 8202,R30
L25:
.dbline 108
subi R22,255 ; offset = 1
sbci R23,255
.dbline 109
L21:
.dbline 104
inc R20
L23:
.dbline 104
cpi R20,16
brlo L20
.dbline -2
.dbline 110
; *datas++;
; }
; }
L19:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r datas 22 pkc
.dbsym l y 4 c
.dbsym r page 18 c
.dbsym r cs 16 c
.dbend
.dbfunc e write_chineseL _write_chineseL fV
; i -> R20
; datas -> R22,R23
; y -> y+6
; page -> R20
; cs -> R10
.even
_write_chineseL::
xcall push_gset3
mov R20,R18
mov R10,R16
ldd R22,y+8
ldd R23,y+9
.dbline -1
.dbline 113
;
; void write_chineseL(uchar cs,uchar page,uchar y,const unsigned char *datas) //下半部分显示
; {
.dbline 115
; uchar i;
; check_busy(1);
ldi R16,1
xcall _check_busy
.dbline 116
; R_command=LCD_PAGE+page; //设置LCD右半屏页地址
mov R24,R20
subi R24,72 ; addi 184
sts 8196,R24
.dbline 117
; L_command=LCD_PAGE+page; //设置LCD左半屏页地址
mov R24,R20
subi R24,72 ; addi 184
sts 8200,R24
.dbline 118
; R_command=LCD_Y+y*16; //设置水平显示位置
ldi R24,16
ldd R0,y+6
mul R24,R0
mov R24,R0
subi R24,192 ; addi 64
sts 8196,R24
.dbline 119
; L_command=LCD_Y+y*16;
ldi R24,16
ldd R0,y+6
mul R24,R0
mov R24,R0
subi R24,192 ; addi 64
sts 8200,R24
.dbline 120
; for(i=0;i<16;i++)
clr R20
xjmp L30
L27:
.dbline 121
; {
.dbline 122
; if(cs) R_data=*datas; //右半屏显示
tst R10
breq L31
.dbline 122
movw R30,R22
lpm R30,Z
sts 8198,R30
xjmp L32
L31:
.dbline 123
; else L_data=*datas; //左半屏显示
movw R30,R22
lpm R30,Z
sts 8202,R30
L32:
.dbline 124
subi R22,255 ; offset = 1
sbci R23,255
.dbline 125
L28:
.dbline 120
inc R20
L30:
.dbline 120
cpi R20,16
brlo L27
.dbline -2
.dbline 126
; *datas++;
; }
; }
L26:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r datas 22 pkc
.dbsym l y 6 c
.dbsym r page 20 c
.dbsym r cs 10 c
.dbend
.dbfunc e main _main fV
.even
_main::
sbiw R28,4
.dbline -1
.dbline 129
;
; void main(void)
; {
.dbline 130
; init_devices();
xcall _init_devices
.dbline 131
; LCD_Clean();
xcall _LCD_Clean
.dbline 132
; LCD_Init();
xcall _LCD_Init
.dbline 133
; write_chineseH(0,0,2,you1);
ldi R24,<_you1
ldi R25,>_you1
std y+3,R25
std y+2,R24
ldi R24,2
std y+0,R24
clr R18
clr R16
xcall _write_chineseH
.dbline -2
.dbline 137
; // write_chineseL(0,1,2,you2);
; // write_chineseH(1,0,0,hu1);
; //write_chineseL(1,1,0,hu2);
; }
L33:
adiw R28,4
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile C:\DOCUME~1\zhuji\桌面\新建文~2\main.c
_flag::
.blkb 1
.dbsym e flag _flag c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -