📄 test.s
字号:
.module test.c
.area text(rom, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 9
; //ICC-AVR application builder : 2005-2-20 上午 10:39:44
; // Target : M16
; // Crystal: 8.0000Mhz
;
; #include <iom16v.h>
; #include <macros.h>
;
; void port_init(void)
; {
.dbline 10
; PORTA = 0xFF;
ldi R24,255
out 0x1b,R24
.dbline 11
; DDRA = 0x00;
clr R2
out 0x1a,R2
.dbline 12
; PORTB = 0xFF;
out 0x18,R24
.dbline 13
; DDRB = 0x00;
out 0x17,R2
.dbline 14
; PORTC = 0xFF; //m103 output only
out 0x15,R24
.dbline 15
; DDRC = 0x00;
out 0x14,R2
.dbline 16
; PORTD = 0xFF;
out 0x12,R24
.dbline 17
; DDRD = 0x00;
out 0x11,R2
.dbline -2
.dbline 18
; }
L1:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 4
jmp _int0_isr
.area text(rom, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.dbfunc e int0_isr _int0_isr fV
.even
_int0_isr::
.dbline -1
.dbline 22
;
; #pragma interrupt_handler int0_isr:2
; void int0_isr(void)
; {
.dbline -2
.dbline 24
; //external interupt on INT0
; }
L2:
.dbline 0 ; func end
reti
.dbend
.area vector(rom, abs)
.org 8
jmp _int1_isr
.area text(rom, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.dbfunc e int1_isr _int1_isr fV
.even
_int1_isr::
.dbline -1
.dbline 28
;
; #pragma interrupt_handler int1_isr:3
; void int1_isr(void)
; {
.dbline -2
.dbline 30
; //external interupt on INT1
; }
L3:
.dbline 0 ; func end
reti
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 34
;
; //call this routine to initialise all peripherals
; void init_devices(void)
; {
.dbline 36
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 37
; port_init();
xcall _port_init
.dbline 39
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 40
; GICR = 0xC0;
ldi R24,192
out 0x3b,R24
.dbline 41
; TIMSK = 0x00; //timer interrupt sources
out 0x39,R2
.dbline 42
; SEI(); //re-enable interrupts
sei
.dbline -2
.dbline 44
; //all peripherals are now initialised
; }
L4:
.dbline 0 ; func end
ret
.dbend
.area data(ram, con, rel)
.dbfile F:\IccAvr_Pro\test.c
_a1::
.blkb 1
.area idata
.byte 10
.area data(ram, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.blkb 2
.area idata
.word 1000
.area data(ram, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.dbstruct 0 3 p
.dbfield 0 t1 c
.dbfield 1 t2 i
.dbend
.dbsym e a1 _a1 S[p]
_pa1::
.blkw 1
.area idata
.word _a1
.area data(ram, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.dbsym e pa1 _pa1 pS[p]
.area lit(rom, con, rel)
L7:
.byte 0,0
.byte 0,0
.area text(rom, con, rel)
.dbfile F:\IccAvr_Pro\test.c
.dbfunc e main _main fV
; te -> R20,R21
; t -> R20
; pc -> R20,R21
; test -> y+0
.even
_main::
sbiw R28,4
.dbline -1
.dbline 54
; const struct p{
; unsigned char t1;
; unsigned int t2;
; };
;
; struct p a1={10,1000};
; struct p *pa1=&a1;
;
; void main()
; {unsigned char t=a1.t1;
.dbline 54
lds R20,_a1
.dbline 55
; unsigned int te=a1.t2;
lds R20,_a1+1
lds R21,_a1+1+1
.dbline 56
; unsigned char test[4]={0,0,0,0};
ldi R24,<L7
ldi R25,>L7
movw R30,R28
ldi R16,4
ldi R17,0
st -y,R31
st -y,R30
st -y,R25
st -y,R24
xcall asgncblk
.dbline 57
; unsigned char *pc=(unsigned char *)(&a1);
ldi R20,<_a1
ldi R21,>_a1
.dbline 58
; test[0]=*pc++;
movw R30,R20
ld R2,Z+
std y+0,R2
.dbline 59
; test[1]=*pc++;
ld R2,Z+
std y+1,R2
.dbline 60
; test[2]=*pc++;
ld R2,Z+
movw R20,R30
std y+2,R2
.dbline 63
;
;
; init_devices();
xcall _init_devices
.dbline -2
.dbline 64
; }
L5:
adiw R28,4
.dbline 0 ; func end
ret
.dbsym r te 20 i
.dbsym r t 20 c
.dbsym r pc 20 pc
.dbsym l test 0 A[4:4]c
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -