home *** CD-ROM | disk | FTP | other *** search
- ; Handoptimized Custom CxObj routine, fast and efficient
- ; Total rewrite of C-Compiler output (which was partial crap)
- ;
- ; This function supports pipelining of the latest MC680x0 processors,
- ; when possible (that means mixing opcodes, that use different
- ; functional units of the processor, to parallelize some processes).
- ; That's also known as "scaling".
- ;
- ; According to the RKM, this function also makes no assumptions about
- ; registers, and restores all registers used by itself to the values
- ; they contained at entry. However, this uses up 20 bytes of stack.
- ;
- ; Only two system functions are called: CxMsgData() and Signal()
-
- XREF _SysBase
- XREF _CxBase
- XREF _listen
- XREF _lastsig
- XREF _prefs
-
- XDEF _cx_custom_func
-
- _cx_custom_func
- movem.l d0/d1/a0/a1/a6,-(sp)
-
- move.l 24(sp),a0 ;get cxm
- move.l _CxBase,a6
- jsr -$90(a6) ;CxMsgData(cxm)
- move.l d0,a0 ;InputEvent
-
- moveq.l #1,d1 ;1
- sub.l d0,d0 ;erase register (faster on '060)
- move.b 4(a0),d0 ;InputEvent->ie_Class
- asl.l d0,d1 ;<<
- and.l _listen,d1 ;(1 << InputEvent->ie_Class) & listen
- beq.b ciao ;if not, quit
-
- move.l _lastsig,d1 ;lastsig
- move.l 14(a0),d0 ;InputEvent->ie_TimeStamp.tv_secs
- cmp.l d0,d1 ;lastsig - InputEvent->ie_TimeStamp.tv_secs
- bhi.b higher ;if higher
-
- sub.l d1,d0 ;else equal/lower, calculate difference
- bra.b delta ;skip higher
-
- higher
- sub.l d0,d1 ;calculate difference
- move.l d1,d0 ;use appropriate register
-
- delta
- cmp.l #1,d0 ;delta - 4
- bls.b ciao ;if lower or same, quit
-
- tst.l _prefs+28 ;prefs.dpmslevel
- beq.b signal ;if null (== DPMS_ON), signal every event
-
- moveq.l #1,d1 ;else 1
- sub.l d0,d0 ;erase register
- move.b 4(a0),d0 ;InputEvent->ie_Class
- asl.l d0,d1 ;<<
- and.l _prefs+24,d1 ;(1 << InputEvent->ie_Class) & prefs.wakeup
- beq.b ciao ;if no wakeup event, quit
-
- signal
- move.l 14(a0),_lastsig ;lastsig = InputEvent->ie_TimeStamp.tv_secs
-
- moveq.l #1,d0 ;1
- move.l _prefs+32,d1 ;prefs.signal
- asl.l d1,d0 ;<<
-
- move.l _prefs+4,a1 ;prefs->cxport
- move.l 16(a1),a1 ;MsgPort->mp_SigTask
- move.l _SysBase,a6
- jsr -$144(a6) ;Signal(prefs.cxport->mp_SigTask, 1 << prefs.signal)
-
- ciao
- movem.l (sp)+,d0/d1/a0/a1/a6
- rts
-
- END
-
-