Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;--------------------------------------------------------
- ; File Created by SDCC : free open source ANSI-C Compiler
- ; Version 3.4.0 #8981 (Apr 5 2014) (MINGW64)
- ; This file was generated Mon Dec 01 15:27:54 2014
- ;--------------------------------------------------------
- .module foo
- .optsdcc -mstm8
- ;--------------------------------------------------------
- ; Public variables in this module
- ;--------------------------------------------------------
- .globl _lut
- .globl _main
- .globl _GPIO_Init
- ;--------------------------------------------------------
- ; ram data
- ;--------------------------------------------------------
- .area DATA
- ;--------------------------------------------------------
- ; ram data
- ;--------------------------------------------------------
- .area INITIALIZED
- ;--------------------------------------------------------
- ; Stack segment in internal ram
- ;--------------------------------------------------------
- .area SSEG
- __start__stack:
- .ds 1
- ;--------------------------------------------------------
- ; absolute external ram data
- ;--------------------------------------------------------
- .area DABS (ABS)
- ;--------------------------------------------------------
- ; interrupt vector
- ;--------------------------------------------------------
- .area HOME
- __interrupt_vect:
- int s_GSINIT ;reset
- int 0x0000 ;trap
- int 0x0000 ;int0
- int 0x0000 ;int1
- int 0x0000 ;int2
- int 0x0000 ;int3
- int 0x0000 ;int4
- int 0x0000 ;int5
- int 0x0000 ;int6
- int 0x0000 ;int7
- int 0x0000 ;int8
- int 0x0000 ;int9
- int 0x0000 ;int10
- int 0x0000 ;int11
- int 0x0000 ;int12
- int 0x0000 ;int13
- int 0x0000 ;int14
- int 0x0000 ;int15
- int 0x0000 ;int16
- int 0x0000 ;int17
- int 0x0000 ;int18
- int 0x0000 ;int19
- int 0x0000 ;int20
- int 0x0000 ;int21
- int 0x0000 ;int22
- int 0x0000 ;int23
- int 0x0000 ;int24
- int 0x0000 ;int25
- int 0x0000 ;int26
- int 0x0000 ;int27
- int 0x0000 ;int28
- int 0x0000 ;int29
- ;--------------------------------------------------------
- ; global & static initialisations
- ;--------------------------------------------------------
- .area HOME
- .area GSINIT
- .area GSFINAL
- .area GSINIT
- __sdcc_gs_init_startup:
- __sdcc_init_data:
- ; stm8_genXINIT() start
- ldw x, #l_DATA
- jreq 00002$
- 00001$:
- clr (s_DATA - 1, x)
- decw x
- jrne 00001$
- 00002$:
- ldw x, #l_INITIALIZER
- jreq 00004$
- 00003$:
- ld a, (s_INITIALIZER - 1, x)
- ld (s_INITIALIZED - 1, x), a
- decw x
- jrne 00003$
- 00004$:
- ; stm8_genXINIT() end
- .area GSFINAL
- jp __sdcc_program_startup
- ;--------------------------------------------------------
- ; Home
- ;--------------------------------------------------------
- .area HOME
- .area HOME
- __sdcc_program_startup:
- jp _main
- ; return from main will return to caller
- ;--------------------------------------------------------
- ; code
- ;--------------------------------------------------------
- .area CODE
- ; foo.c: 13: static char findEntryBad(uint8_t key, uint8_t* val1, uint8_t* val2)
- ; -----------------------------------------
- ; function findEntryBad
- ; -----------------------------------------
- _findEntryBad:
- sub sp, #3
- ; foo.c: 16: for (i = 0; ; i++)
- ldw x, #_lut+0
- ldw (0x02, sp), x
- clr (0x03, sp)
- clr (0x01, sp)
- 00107$:
- ; foo.c: 19: j = lut[ii + 0];
- clrw x
- ld a, (0x01, sp)
- ld xl, a
- addw x, (0x02, sp)
- ld a, (x)
- ; foo.c: 20: if (j == key) // found
- cp a, (0x06, sp)
- jrne 00104$
- ; foo.c: 22: *val1 = lut[ii + 1];
- ldw y, (0x07, sp)
- ld a, (0x01, sp)
- inc a
- clrw x
- ld xl, a
- addw x, (0x02, sp)
- ld a, (x)
- ld (y), a
- ; foo.c: 23: *val2 = lut[ii + 2];
- ldw y, (0x09, sp)
- ld a, (0x01, sp)
- add a, #0x02
- clrw x
- ld xl, a
- addw x, (0x02, sp)
- ld a, (x)
- ld (y), a
- ; foo.c: 24: return 1;
- ld a, #0x01
- jra 00109$
- 00104$:
- ; foo.c: 26: else if (j == 0) // end of table
- tnz a
- jrne 00108$
- ; foo.c: 28: return 0;
- clr a
- jra 00109$
- 00108$:
- ; foo.c: 16: for (i = 0; ; i++)
- ld a, (0x01, sp)
- add a, #0x03
- ld (0x01, sp), a
- jra 00107$
- ; foo.c: 31: return 0;
- 00109$:
- addw sp, #3
- ret
- ; foo.c: 35: static char findEntryGood(uint8_t key, uint8_t* val1, uint8_t* val2)
- ; -----------------------------------------
- ; function findEntryGood
- ; -----------------------------------------
- _findEntryGood:
- sub sp, #6
- ; foo.c: 38: for (i = 0; ; i++)
- clr (0x03, sp)
- ldw x, #_lut+0
- ldw (0x05, sp), x
- 00107$:
- ; foo.c: 40: ii = i * 3; // table has 3 columns
- ld a, (0x03, sp)
- ld xl, a
- ld a, #0x03
- mul x, a
- ld a, xl
- ld (0x02, sp), a
- ; foo.c: 41: j = lut[ii + 0];
- clrw x
- ld a, (0x02, sp)
- ld xl, a
- addw x, (0x05, sp)
- ld a, (x)
- ld (0x01, sp), a
- ; foo.c: 42: if (j == key) // found
- ld a, (0x01, sp)
- cp a, (0x09, sp)
- jrne 00104$
- ; foo.c: 44: *val1 = lut[ii + 1];
- ldw y, (0x0a, sp)
- ld a, (0x02, sp)
- inc a
- clrw x
- ld xl, a
- addw x, (0x05, sp)
- ld a, (x)
- ld (y), a
- ; foo.c: 45: *val2 = lut[ii + 2];
- ldw y, (0x0c, sp)
- ld a, (0x02, sp)
- add a, #0x02
- clrw x
- ld xl, a
- addw x, (0x05, sp)
- ld a, (x)
- ld (y), a
- ; foo.c: 46: return 1;
- ld a, #0x01
- jra 00109$
- 00104$:
- ; foo.c: 48: else if (j == 0) // end of table
- tnz (0x01, sp)
- jrne 00108$
- ; foo.c: 50: return 0;
- clr a
- jra 00109$
- 00108$:
- ; foo.c: 38: for (i = 0; ; i++)
- ld a, (0x03, sp)
- inc a
- ld (0x04, sp), a
- ld a, (0x04, sp)
- ld (0x03, sp), a
- jra 00107$
- ; foo.c: 53: return 0;
- 00109$:
- addw sp, #6
- ret
- ; foo.c: 56: void main(void)
- ; -----------------------------------------
- ; function main
- ; -----------------------------------------
- _main:
- pushw x
- ; foo.c: 60: res = findEntryBad(0x12, &v1, &v2);
- ldw y, sp
- incw y
- ldw x, sp
- incw x
- incw x
- pushw y
- pushw x
- push #0x12
- call _findEntryBad
- addw sp, #5
- ; foo.c: 62: if (v2 == 0xCD)
- ld a, (0x01, sp)
- cp a, #0xcd
- jrne 00102$
- ; foo.c: 64: GPIO_Init(GPIOB, GPIO_PIN_2, GPIO_MODE_OUT_PP_LOW_FAST);
- push #0xe0
- push #0x04
- push #0x05
- push #0x50
- call _GPIO_Init
- addw sp, #4
- jra 00105$
- 00102$:
- ; foo.c: 68: GPIO_Init(GPIOB, GPIO_PIN_2, GPIO_MODE_OUT_PP_HIGH_FAST);
- push #0xf0
- push #0x04
- push #0x05
- push #0x50
- call _GPIO_Init
- addw sp, #4
- ; foo.c: 71: while (1);
- 00105$:
- jra 00105$
- popw x
- ret
- .area CODE
- _lut:
- .db #0x12 ; 18
- .db #0xAB ; 171
- .db #0xCD ; 205
- .db #0x34 ; 52 '4'
- .db #0xEF ; 239
- .db #0x98 ; 152
- .db #0x56 ; 86 'V'
- .db #0xC6 ; 198
- .db #0xDA ; 218
- .db #0x00 ; 0
- .db #0x00 ; 0
- .db #0x00 ; 0
- .area INITIALIZER
- .area CABS (ABS)
Advertisement
Add Comment
Please, Sign In to add comment