다음과 같은 경우는 어떤 순서로 실행되는건가요?
H8/300 계열의 어셈블리 코드입니다만, 그건 중요하지 않구요.
다음과 같이 .global 심볼이 여러 개 선언되어 있으면 어떤 순서로 프로그램이 실행되는지 궁금합니다. 인터넷을 뒤져도 못 찾겠네요...
아래 보시면
.global _systime_handler
.global _systime_tm_return
이렇게 되어있는데 실행은 순서되로 되는것인지요....(분기문을 제외한다면요)
소스 나갑니당.
extern void systime_handler(void);
__asm__("
.text
.align 1
.global _systime_handler
.global _systime_tm_return
_systime_handler:
; r6 saved by ROM
push r0 ; both motors & task
; switcher need this reg.
; increment system timer
mov.w @_sys_time+2,r6 ; LSW -> r6
add.b #0x1,r6l ; 16 bit: add 1
addx #0x0,r6h
mov.w r6,@_sys_time+2
bcc sys_nohigh ; speedup for 65535 cases
mov.w @_sys_time,r6 ; MSW -> r6
add.b #0x1,r6l
addx #0x0,r6h
mov.w r6,@_sys_time
sys_nohigh:
"
#ifdef CONF_DMOTOR
"
jsr _dm_handler ; call motor driver
"
#endif
#ifdef CONF_DSOUND
"
jsr _dsound_handler ; call sound handler
"
#endif
#ifdef CONF_LNP
"
mov.w @_lnp_timeout_counter,r6 ; check LNP timeout counter
subs #0x1,r6
mov.w r6,r6 ; subs doesn't change flags!
bne sys_noreset
jsr _lnp_integrity_reset
mov.w @_lnp_timeout,r6 ; reset timeout
sys_noreset:mov.w r6,@_lnp_timeout_counter
"
#endif
#ifdef CONF_DKEY
" jsr _dkey_handler
"
#endif
#ifdef CONF_BATTERY_INDICATOR
"
mov.w @_battery_refresh_counter,r6
subs #0x1,r6
bne batt_norefresh
jsr _battery_refresh
mov.w @_battery_refresh_period,r6
batt_norefresh:mov.w r6,@_battery_refresh_counter
"
#endif
#ifdef CONF_AUTOSHUTOFF
"
mov.w @_auto_shutoff_counter,r6
subs #0x1,r6
bne auto_notshutoff
jsr _autoshutoff_check
mov.w @_auto_shutoff_period,r6
auto_notshutoff:
mov.w r6,@_auto_shutoff_counter
"
#endif
#ifdef CONF_VIS
"
mov.b @_vis_refresh_counter,r6l
dec r6l
bne vis_norefresh
jsr _vis_handler
mov.b @_vis_refresh_period,r6l
vis_norefresh: mov.b r6l,@_vis_refresh_counter
"
#endif
#ifdef CONF_LCD_REFRESH
"
mov.b @_lcd_refresh_counter,r6l
dec r6l
bne lcd_norefresh
jsr _lcd_refresh_next_byte
mov.b @_lcd_refresh_period,r6l
lcd_norefresh:mov.b r6l,@_lcd_refresh_counter
"
#endif
#ifdef CONF_TM
"
mov.b @_tm_current_slice,r6l
dec r6l
bne sys_noswitch ; timeslice elapsed?
mov.w @_tm_switcher_vector,r6
jsr @r6 ; call task switcher
_systime_tm_return:
mov.b @_tm_timeslice,r6l ; new timeslice
sys_noswitch:mov.b r6l,@_tm_current_slice
"
#endif
"
pop r0
bclr #3,@0x91:8 ; reset compare A IRQ flag
rts
");
댓글 달기