                incdir  include:
                incdir  lvo:
                incdir  powerasm:source/powerpc_lib/warprace/

**      '(C) Copyright 1997 Haage & Partner Computer GmbH'
**           All Rights Reserved

                include intuition/intuition.i
                include powerpc/ppcmacros.i
                include powerpc/powerpc.i
                include warprace.i

                include exec_lib.i
                include graphics_lib.i
                include powerpc_lib.i

                xref    _SysBase
                xref    _GfxBase
                xref    _PowerPCBase
                xref    _Window

                xdef    PixelOMania_PPC

                smalldata
                escapestr

                section code


;In:  r5 -> WRI structure
;Out: r3 -> Result time or NULL

PixelOMania_PPC
                prolog
                pushgpr r25-r31
                lw      r3,_Window
                mr      r25,r5
                lwz     r31,wd_UserPort(r3)
                lwz     r29,wd_RPort(r3)
                li      r30,0
                li      r28,0
                li      r27,0
                li      r26,1
                lwz     r3,WRI_STARTTIMER_PPC(r25)
                mtlr    r3
                lwz     r3,WRI_LINKERDB(r25)
                blrl
.loop
                mr      r5,r31
                RUN68K  _SysBase,GetMsg
                tstw    r3
                beq     .nomsg
                lwz     r4,im_Class(r3)
                liw     r5,IDCMP_MOUSEBUTTONS
                and.    r4,r4,r5
                beq     .nomsg
                li      r30,-1
                mr      r6,r3
                RUN68K  _SysBase,ReplyMsg
.nomsg
                tstw    r30
                bne     .abort
                mr      r6,r29
                mr      r3,r26
                xori    r26,r26,2
                RUN68K  _GfxBase,SetAPen
                mr      r6,r29
                mr      r3,r27
                mr      r4,r28
                RUN68K  _GfxBase,WritePixel
                addi    r27,r27,1
                cmplwi  r27,96
                blt     .loop
                li      r27,0
                addi    r28,r28,1
                cmplwi  r28,64
                blt     .loop
                lwz     r3,WRI_STOPTIMER_PPC(r25)
                mtlr    r3
                lwz     r3,WRI_LINKERDB(r25)
                blrl
                b       .exit
.abort
                li      r3,0
.exit
                popgpr
                epilog

