Advertisement
lukhavi

Atiny2313_MatrizGlobal_asmC++

May 6th, 2020
4,886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 1.83 KB | None | 0 0
  1. #define __AVR_ATtiny2313__
  2. #include <avr/io.h>
  3.  
  4. int Mat[2][2]={{18,33},
  5.                 {78,129}};
  6. int main(void){
  7. int sum =0;
  8. while("uno")
  9.         sum = Mat[0][0] + Mat[0][1];
  10. return 0;
  11. }
  12.  
  13.         .file   "matrizG.cpp"
  14. __SP_H__ = 0x3e
  15. __SP_L__ = 0x3d
  16. __SREG__ = 0x3f
  17. __tmp_reg__ = 0         // registro r0, convencion de almacenamiento temporal
  18. __zero_reg__ = 1        // registro r1 siempre es cero
  19.  
  20. .global Mat
  21.         .data
  22.         .type   Mat, @object
  23.         .size   Mat, 8
  24. Mat:
  25.         .word   18
  26.         .word   33
  27.         .word   78
  28.         .word   129
  29.         .text
  30. .global main
  31.         .type   main, @function
  32. main:
  33.         push r28         ;
  34.         push r29         ;
  35.          ; SP -= 2       ;
  36.         rcall .
  37.         in r28,__SP_L__  ;
  38.         in r29,__SP_H__  ;
  39. /* prologue: function */
  40. /* frame size = 2 */
  41. /* stack size = 4 */
  42. .L__stack_usage = 4
  43.         std Y+2,__zero_reg__     ;  sum,        // sum va a al Pila
  44.         std Y+1,__zero_reg__     ;  sum,        // r1 = 0 y push 0 en Pila, (sum = 0)
  45. .L2:
  46.         lds r18,Mat      ;  D.1988, Mat         // usa direccion Mat
  47.         lds r19,Mat+1    ;  D.1988, Mat         // toma Mat[0][0]
  48.         lds r24,Mat+2    ;  D.1988, Mat         // toma MAt[0][1]
  49.         lds r25,Mat+2+1  ;  D.1988, Mat
  50.         add r24,r18      ;  tmp45, D.1988       // los suma
  51.         adc r25,r19      ; , D.1988             // con carry si lo hay
  52.         std Y+2,r25      ;  sum, tmp45          // copia la suma en sum
  53.         std Y+1,r24      ;  sum, tmp45
  54.         rjmp .L2         ;                      // ciclo sin fin
  55.         .size   main, .-main
  56.         .ident  "GCC: (GNU) 4.8.2"
  57. .global __do_copy_data                          // linker asigna direccion de Mat
  58.                                                 // e indica copiar datos a RAM en esa dirección
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement