Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<avr/io.h>
- int main(void){
- int x = 17;
- int& ref_x = x;
- ref_x = 33;
- return 0;
- }
- .file "tiny2.cpp"
- __SP_L__ = 0x3d
- __SREG__ = 0x3f
- __tmp_reg__ = 0
- __zero_reg__ = 1
- .text
- .global main
- .type main, @function
- main:
- push r28 ; // reserva YL en Pila y Stack = Stack -1
- push r29 ; // reserva YH en Pila y Stack = Stack -1
- in r28,__SP_L__ ; // YL = r28 = Stack-2 = SPL
- clr r29 ; // SPH = r29 = 0
- subi r28,lo8(-(-4)) ; // SP = SPL-4 ---> puntal de referencia
- out __SP_L__,r28 ; // SP == Y
- /* prologue: function */
- /* frame size = 4 */ // marco de pila 4 bytes
- /* stack size = 6 */ // SP = SPL:SPH --> r28:r29 == YL:YH = Y --> YH:YL=SPH:SPL= SP
- .L__stack_usage = 6 // x es de 16 bits = 1 palabra
- ldi r24,lo8(17) ; tmp44, // low(x)
- ldi r25,0 ; // hi(x)
- std Y+4,r25 ; x, tmp44 // store hi(x) en SP+4
- std Y+3,r24 ; x, tmp44 // store low(x) en SP+3
- movw r24,r28 ; tmp45, // r28=SPL=YL i.e. r24 = SPL
- adiw r24,3 ; tmp45, // add (SP + 3) en R25:R24
- std Y+2,r25 ; ref_x, tmp45 // store (SP+3) en Stack
- std Y+1,r24 ; ref_x, tmp45 // idem
- ldd r24,Y+1 ; tmp46, ref_x // load (SP +3) desde Stack a r25:r24
- ldd r25,Y+2 ; tmp46, ref_x // idem
- ldi r18,lo8(33) ; tmp47, // r19:r18 = 33
- ldb r19,0 ; // idem
- movw r30,r24 ; , tmp46 // Z = r31:r30 = r25:r24 => Z = (SP+3)
- std Z+1,r19 ; *ref_x_1, tmp47 // store r19:r18=33 en Z+1 = (SP+4) y Z = (SP +3)
- st Z,r18 ; *ref_x_1, tmp47 // x esta en xH:xL = |(SP+4):(SP+3)|
- ldi r24,0 ; D.1984 // r24 = 0
- ldi r25,0 ; D.1984 // r25 = 0
- /* epilogue start */
- subi r28,lo8(-(4)) ; // r28 = SP+4 // restaura Puntero de Pila
- out __SP_L__,r28 ; // Stack = Y+4
- pop r29 ; // retira r29 y Stack = Stack +1
- pop r28 ; // retira r28 y Stack = Stack +1 = RAMEND
- ret // retorna
- .size main, .-main
- .ident "GCC: (GNU) 4.8.2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement