Annotation of hatari/src/cpu/events_normal.h, revision 1.1

1.1     ! root        1: 
        !             2: STATIC_INLINE void cycles_do_special (void)
        !             3: {
        !             4: }
        !             5: STATIC_INLINE void set_cycles (int c)
        !             6: {
        !             7: }
        !             8: 
        !             9: STATIC_INLINE void events_schedule (void)
        !            10: {
        !            11:        int i;
        !            12: 
        !            13:        unsigned long int mintime = ~0L;
        !            14:        for (i = 0; i < ev_max; i++) {
        !            15:                if (eventtab[i].active) {
        !            16:                        unsigned long int eventtime = eventtab[i].evtime - currcycle;
        !            17:                        if (eventtime < mintime)
        !            18:                                mintime = eventtime;
        !            19:                }
        !            20:        }
        !            21:        nextevent = currcycle + mintime;
        !            22: }
        !            23: 
        !            24: STATIC_INLINE void do_cycles_slow (unsigned long cycles_to_add)
        !            25: {
        !            26:        if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= cycles_to_add
        !            27:                && (long int)(read_processor_time () - vsyncmintime) < 0)
        !            28:                return;
        !            29: 
        !            30:        while ((nextevent - currcycle) <= cycles_to_add) {
        !            31:                int i;
        !            32:                cycles_to_add -= (nextevent - currcycle);
        !            33:                currcycle = nextevent;
        !            34: 
        !            35:                for (i = 0; i < ev_max; i++) {
        !            36:                        if (eventtab[i].active && eventtab[i].evtime == currcycle) {
        !            37:                                (*eventtab[i].handler)();
        !            38:                        }
        !            39:                }
        !            40:                events_schedule();
        !            41:        }
        !            42:        currcycle += cycles_to_add;
        !            43: }
        !            44: 
        !            45: STATIC_INLINE void do_cycles_fast (void)
        !            46: {
        !            47:        if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= 1
        !            48:                && (long int)(read_processor_time () - vsyncmintime) < 0)
        !            49:                return;
        !            50: 
        !            51:        currcycle++;
        !            52:        if (nextevent == currcycle) {
        !            53:                int i;
        !            54: 
        !            55:                for (i = 0; i < ev_max; i++) {
        !            56:                        if (eventtab[i].active && eventtab[i].evtime == currcycle) {
        !            57:                                (*eventtab[i].handler) ();
        !            58:                        }
        !            59:                }
        !            60:                events_schedule();
        !            61:        }
        !            62: 
        !            63: }
        !            64: 
        !            65: /* This is a special-case function.  Normally, all events should lie in the
        !            66: future; they should only ever be active at the current cycle during
        !            67: do_cycles.  However, a snapshot is saved during do_cycles, and so when
        !            68: restoring it, we may have other events pending.  */
        !            69: STATIC_INLINE void handle_active_events (void)
        !            70: {
        !            71:        int i;
        !            72:        for (i = 0; i < ev_max; i++) {
        !            73:                if (eventtab[i].active && eventtab[i].evtime == currcycle) {
        !            74:                        (*eventtab[i].handler)();
        !            75:                }
        !            76:        }
        !            77: }
        !            78: 
        !            79: STATIC_INLINE unsigned long get_cycles (void)
        !            80: {
        !            81:        return currcycle;
        !            82: }
        !            83: 
        !            84: extern void init_eventtab (void);
        !            85: 
        !            86: #if /* M68K_SPEED == 1 */  0
        !            87: #define do_cycles do_cycles_fast
        !            88: #else
        !            89: #define do_cycles do_cycles_slow
        !            90: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.