Guest User

Untitled

a guest
Dec 1st, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;--------------------------------------------------------
  2. ; File Created by SDCC : free open source ANSI-C Compiler
  3. ; Version 3.4.0 #8981 (Apr  5 2014) (MINGW64)
  4. ; This file was generated Mon Dec 01 15:27:54 2014
  5. ;--------------------------------------------------------
  6.     .module foo
  7.     .optsdcc -mstm8
  8.    
  9. ;--------------------------------------------------------
  10. ; Public variables in this module
  11. ;--------------------------------------------------------
  12.     .globl _lut
  13.     .globl _main
  14.     .globl _GPIO_Init
  15. ;--------------------------------------------------------
  16. ; ram data
  17. ;--------------------------------------------------------
  18.     .area DATA
  19. ;--------------------------------------------------------
  20. ; ram data
  21. ;--------------------------------------------------------
  22.     .area INITIALIZED
  23. ;--------------------------------------------------------
  24. ; Stack segment in internal ram
  25. ;--------------------------------------------------------
  26.     .area   SSEG
  27. __start__stack:
  28.     .ds 1
  29.  
  30. ;--------------------------------------------------------
  31. ; absolute external ram data
  32. ;--------------------------------------------------------
  33.     .area DABS (ABS)
  34. ;--------------------------------------------------------
  35. ; interrupt vector
  36. ;--------------------------------------------------------
  37.     .area HOME
  38. __interrupt_vect:
  39.     int s_GSINIT ;reset
  40.     int 0x0000 ;trap
  41.     int 0x0000 ;int0
  42.     int 0x0000 ;int1
  43.     int 0x0000 ;int2
  44.     int 0x0000 ;int3
  45.     int 0x0000 ;int4
  46.     int 0x0000 ;int5
  47.     int 0x0000 ;int6
  48.     int 0x0000 ;int7
  49.     int 0x0000 ;int8
  50.     int 0x0000 ;int9
  51.     int 0x0000 ;int10
  52.     int 0x0000 ;int11
  53.     int 0x0000 ;int12
  54.     int 0x0000 ;int13
  55.     int 0x0000 ;int14
  56.     int 0x0000 ;int15
  57.     int 0x0000 ;int16
  58.     int 0x0000 ;int17
  59.     int 0x0000 ;int18
  60.     int 0x0000 ;int19
  61.     int 0x0000 ;int20
  62.     int 0x0000 ;int21
  63.     int 0x0000 ;int22
  64.     int 0x0000 ;int23
  65.     int 0x0000 ;int24
  66.     int 0x0000 ;int25
  67.     int 0x0000 ;int26
  68.     int 0x0000 ;int27
  69.     int 0x0000 ;int28
  70.     int 0x0000 ;int29
  71. ;--------------------------------------------------------
  72. ; global & static initialisations
  73. ;--------------------------------------------------------
  74.     .area HOME
  75.     .area GSINIT
  76.     .area GSFINAL
  77.     .area GSINIT
  78. __sdcc_gs_init_startup:
  79. __sdcc_init_data:
  80. ; stm8_genXINIT() start
  81.     ldw x, #l_DATA
  82.     jreq    00002$
  83. 00001$:
  84.     clr (s_DATA - 1, x)
  85.     decw x
  86.     jrne    00001$
  87. 00002$:
  88.     ldw x, #l_INITIALIZER
  89.     jreq    00004$
  90. 00003$:
  91.     ld  a, (s_INITIALIZER - 1, x)
  92.     ld  (s_INITIALIZED - 1, x), a
  93.     decw    x
  94.     jrne    00003$
  95. 00004$:
  96. ; stm8_genXINIT() end
  97.     .area GSFINAL
  98.     jp  __sdcc_program_startup
  99. ;--------------------------------------------------------
  100. ; Home
  101. ;--------------------------------------------------------
  102.     .area HOME
  103.     .area HOME
  104. __sdcc_program_startup:
  105.     jp  _main
  106. ;   return from main will return to caller
  107. ;--------------------------------------------------------
  108. ; code
  109. ;--------------------------------------------------------
  110.     .area CODE
  111. ;   foo.c: 13: static char findEntryBad(uint8_t key, uint8_t* val1, uint8_t* val2)
  112. ;   -----------------------------------------
  113. ;    function findEntryBad
  114. ;   -----------------------------------------
  115. _findEntryBad:
  116.     sub sp, #3
  117. ;   foo.c: 16: for (i = 0; ; i++)
  118.     ldw x, #_lut+0
  119.     ldw (0x02, sp), x
  120.     clr (0x03, sp)
  121.     clr (0x01, sp)
  122. 00107$:
  123. ;   foo.c: 19: j = lut[ii + 0];
  124.     clrw    x
  125.     ld  a, (0x01, sp)
  126.     ld  xl, a
  127.     addw    x, (0x02, sp)
  128.     ld  a, (x)
  129. ;   foo.c: 20: if (j == key) // found
  130.     cp  a, (0x06, sp)
  131.     jrne    00104$
  132. ;   foo.c: 22: *val1 = lut[ii + 1];
  133.     ldw y, (0x07, sp)
  134.     ld  a, (0x01, sp)
  135.     inc a
  136.     clrw    x
  137.     ld  xl, a
  138.     addw    x, (0x02, sp)
  139.     ld  a, (x)
  140.     ld  (y), a
  141. ;   foo.c: 23: *val2 = lut[ii + 2];
  142.     ldw y, (0x09, sp)
  143.     ld  a, (0x01, sp)
  144.     add a, #0x02
  145.     clrw    x
  146.     ld  xl, a
  147.     addw    x, (0x02, sp)
  148.     ld  a, (x)
  149.     ld  (y), a
  150. ;   foo.c: 24: return 1;
  151.     ld  a, #0x01
  152.     jra 00109$
  153. 00104$:
  154. ;   foo.c: 26: else if (j == 0) // end of table
  155.     tnz a
  156.     jrne    00108$
  157. ;   foo.c: 28: return 0;
  158.     clr a
  159.     jra 00109$
  160. 00108$:
  161. ;   foo.c: 16: for (i = 0; ; i++)
  162.     ld  a, (0x01, sp)
  163.     add a, #0x03
  164.     ld  (0x01, sp), a
  165.     jra 00107$
  166. ;   foo.c: 31: return 0;
  167. 00109$:
  168.     addw    sp, #3
  169.     ret
  170. ;   foo.c: 35: static char findEntryGood(uint8_t key, uint8_t* val1, uint8_t* val2)
  171. ;   -----------------------------------------
  172. ;    function findEntryGood
  173. ;   -----------------------------------------
  174. _findEntryGood:
  175.     sub sp, #6
  176. ;   foo.c: 38: for (i = 0; ; i++)
  177.     clr (0x03, sp)
  178.     ldw x, #_lut+0
  179.     ldw (0x05, sp), x
  180. 00107$:
  181. ;   foo.c: 40: ii = i * 3; // table has 3 columns
  182.     ld  a, (0x03, sp)
  183.     ld  xl, a
  184.     ld  a, #0x03
  185.     mul x, a
  186.     ld  a, xl
  187.     ld  (0x02, sp), a
  188. ;   foo.c: 41: j = lut[ii + 0];
  189.     clrw    x
  190.     ld  a, (0x02, sp)
  191.     ld  xl, a
  192.     addw    x, (0x05, sp)
  193.     ld  a, (x)
  194.     ld  (0x01, sp), a
  195. ;   foo.c: 42: if (j == key) // found
  196.     ld  a, (0x01, sp)
  197.     cp  a, (0x09, sp)
  198.     jrne    00104$
  199. ;   foo.c: 44: *val1 = lut[ii + 1];
  200.     ldw y, (0x0a, sp)
  201.     ld  a, (0x02, sp)
  202.     inc a
  203.     clrw    x
  204.     ld  xl, a
  205.     addw    x, (0x05, sp)
  206.     ld  a, (x)
  207.     ld  (y), a
  208. ;   foo.c: 45: *val2 = lut[ii + 2];
  209.     ldw y, (0x0c, sp)
  210.     ld  a, (0x02, sp)
  211.     add a, #0x02
  212.     clrw    x
  213.     ld  xl, a
  214.     addw    x, (0x05, sp)
  215.     ld  a, (x)
  216.     ld  (y), a
  217. ;   foo.c: 46: return 1;
  218.     ld  a, #0x01
  219.     jra 00109$
  220. 00104$:
  221. ;   foo.c: 48: else if (j == 0) // end of table
  222.     tnz (0x01, sp)
  223.     jrne    00108$
  224. ;   foo.c: 50: return 0;
  225.     clr a
  226.     jra 00109$
  227. 00108$:
  228. ;   foo.c: 38: for (i = 0; ; i++)
  229.     ld  a, (0x03, sp)
  230.     inc a
  231.     ld  (0x04, sp), a
  232.     ld  a, (0x04, sp)
  233.     ld  (0x03, sp), a
  234.     jra 00107$
  235. ;   foo.c: 53: return 0;
  236. 00109$:
  237.     addw    sp, #6
  238.     ret
  239. ;   foo.c: 56: void main(void)
  240. ;   -----------------------------------------
  241. ;    function main
  242. ;   -----------------------------------------
  243. _main:
  244.     pushw   x
  245. ;   foo.c: 60: res = findEntryBad(0x12, &v1, &v2);
  246.     ldw y, sp
  247.     incw    y
  248.     ldw x, sp
  249.     incw    x
  250.     incw    x
  251.     pushw   y
  252.     pushw   x
  253.     push    #0x12
  254.     call    _findEntryBad
  255.     addw    sp, #5
  256. ;   foo.c: 62: if (v2 == 0xCD)
  257.     ld  a, (0x01, sp)
  258.     cp  a, #0xcd
  259.     jrne    00102$
  260. ;   foo.c: 64: GPIO_Init(GPIOB, GPIO_PIN_2, GPIO_MODE_OUT_PP_LOW_FAST);
  261.     push    #0xe0
  262.     push    #0x04
  263.     push    #0x05
  264.     push    #0x50
  265.     call    _GPIO_Init
  266.     addw    sp, #4
  267.     jra 00105$
  268. 00102$:
  269. ;   foo.c: 68: GPIO_Init(GPIOB, GPIO_PIN_2, GPIO_MODE_OUT_PP_HIGH_FAST);
  270.     push    #0xf0
  271.     push    #0x04
  272.     push    #0x05
  273.     push    #0x50
  274.     call    _GPIO_Init
  275.     addw    sp, #4
  276. ;   foo.c: 71: while (1);
  277. 00105$:
  278.     jra 00105$
  279.     popw    x
  280.     ret
  281.     .area CODE
  282. _lut:
  283.     .db #0x12   ; 18
  284.     .db #0xAB   ; 171
  285.     .db #0xCD   ; 205
  286.     .db #0x34   ; 52    '4'
  287.     .db #0xEF   ; 239
  288.     .db #0x98   ; 152
  289.     .db #0x56   ; 86    'V'
  290.     .db #0xC6   ; 198
  291.     .db #0xDA   ; 218
  292.     .db #0x00   ; 0
  293.     .db #0x00   ; 0
  294.     .db #0x00   ; 0
  295.     .area INITIALIZER
  296.     .area CABS (ABS)
Advertisement
Add Comment
Please, Sign In to add comment