home *** CD-ROM | disk | FTP | other *** search
- *****************************************
- * PAULS BLANKER *
- * by Paul Hayter (C)1991 *
- * *
- * based on Blanker2 on Amigan 17 *
- * by Joe Hitchens *
- * V1.0 910406 *
- * V1.1 910407 default blank in 2 mins *
- * optional screen blank time *
- * auto ptr blank in 10 secs *
- * mouse parabolic accelerator *
- * V1.2 910413 Uses actual timestamp *
- * info in working out whether *
- * to blank or not *
- * V1.3 910418 Processes all input *
- * events in the chain
- *****************************************
-
- * USAGE:
- * pbl [time]
- * time = time before blanking in seconds
- * eg. pbl 180 {3 minutes}
- * NB: Does not need to be RUN
- * Also there is no way of changing settings or removing the blanker
-
- include "PHAD:defs/exec.defs"
- include "PHAD:offs/exec.i"
- include "PHAD:defs/devices.defs"
- include "PHAD:defs/hardware.defs"
-
- privatestore equ 0
- PTblack equ privatestore 0=not blank
- SCblack equ PTblack+1 0=not blank
- last_ptr_secs equ SCblack+1
- last_scr_secs equ last_ptr_secs+4
- ptr_secs equ last_scr_secs+4
- scr_secs equ ptr_secs+4
- first_time equ scr_secs+4
-
- SIZEOF_PS equ first_time+2
-
-
- custom equ $dff000
-
- DEFAULT_PTR_BLANK equ 10 10 seconds
- DEFAULT_SCR_BLANK equ 120 2 minutes
-
- START move.l #DEFAULT_SCR_BLANK,d7
- sub.w #$2,d0
- blt START2
-
- moveq #0,d7
- moveq #0,d1
- move.b (a0)+,d1
- loop2 cmp.b #$20,d1
- beq.s START2
- sub.b #$30,d1
- mulu #$A,d7
- add.l d1,d7
- move.b (a0)+,d1
- dbra d0,loop2
-
- START2 move.l 4,a6
- bsr createport34
- move.l d0,msgport
- move.l d0,a0
- bsr createio48
- move.l d0,ioreq
- lea inputname(pc),a0
- move.l d0,a1
- moveq #0,d0
- moveq #0,d1
- jsr _LVOOpenDevice(a6) OPEN INPUT.DEVICE
-
- move.l #MEMF_CLEAR,D1
- move.l #endhandler-myhandler+IS_SIZE+SIZEOF_PS,d0
- jsr _LVOAllocMem(a6)
- MOVE.L D0,A3
- lea myhandler(pc),a0
- lea endhandler(pc),a1
- move.l d0,a2
- loop_1 move.b (a0)+,(a2)+ COPY HANDLER CODE
- cmp.l a0,a1
- bne.s loop_1
-
- lea privatepos(a3),a0
- move.l d7,scr_secs(a0)
- move.l #DEFAULT_PTR_BLANK,ptr_secs(a0)
-
- move.l a0,IS_DATA+intpos(a3)
-
- move.l a3,IS_CODE+intpos(a3)
- move.b #51,IS_NODE+LN_PRI+intpos(a3)
- * handlerStuff->is_Node.ln_Name = p->Name;
- move.l ioreq(pc),a4
- move.w #IND_ADDHANDLER,io_Command(a4)
- lea intpos(a3),a1
- move.l a1,io_Data(a4)
-
- move.l a4,a1
- jsr _LVODoIO(a6)
- move.l a4,a1
- jsr _LVOCloseDevice(a6)
-
- move.l a4,a0
- bsr deleteio
- move.l msgport(pc),a0
- bsr deleteport
- moveq #0,d0
- rts
-
-
- createport34 moveq #34,d0
- sub.l a0,a0
- createport movem.l d2/a2-a3,-(sp) in: d0 = SIZEOF; out: d0 = port
- move.l a0,a3 name*
- addq.l #4,d0 space for SIZEOF
- move.l d0,d2
- move.l #MEMF_PUBLIC!MEMF_CLEAR,d1
- jsr _LVOAllocMem(a6)
- move.l d0,a2
- tst.l d0
- beq.s creaport1 -> no mem
- move.l d2,(a2)+ save SIZEOF
- moveq #-1,d0
- jsr _LVOAllocSignal(a6)
- move.b d0,MP_SIGBIT(a2)
- bmi.s creaporte -> no sigbit
- sub.l a1,a1
- jsr _LVOFindTask(a6)
- move.l d0,MP_SIGTASK(a2)
- move.b #NT_MSGPORT,LN_TYPE(a2)
- move.l a3,LN_NAME(a2)
- move.b #PA_SIGNAL,MP_FLAGS(a2)
- lea MP_MSGLIST(a2),a0
- ; NEWLIST A0:
- move.l a0,(a0)
- addq.l #LH_TAIL,(a0)
- clr.l LH_TAIL(a0)
- move.l a0,(LH_TAIL+LN_PRED)(a0)
- ; ;
- move.l a2,d0
- bra.s creaport1
- deleteport movem.l d2/a2-a3,-(sp) In: port in a0
- move.l a0,d0
- beq.s creaport1 -> no port to delete
- move.l a0,a2
- moveq.l #0,d0
- move.b MP_SIGBIT(a2),d0
- bmi.s creaporte -> no sigbit to free
- jsr _LVOFreeSignal(a6)
- creaporte move.l -(a2),d0 SIZEOF
- move.l a2,a1
- jsr _LVOFreeMem(a6)
- moveq.l #0,d0
- creaport1 movem.l (sp)+,d2/a2-a3
- move.l d0,a0
- rts
-
- createio48 moveq #48,d0
- createio movem.l d2/a2,-(sp) in: d0=SIZEOF, a0=MsgPort; out: d0=ioreq
- move.l a0,a2 save msgport*
- addq #4,d0 space for SIZEOF
- move.l d0,d2
- move.l #MEMF_PUBLIC!MEMF_CLEAR,d1
- jsr _LVOAllocMem(a6)
- move.l d0,a0
- tst.l d0
- beq.s createio_e -> no mem
- move.l d2,(a0)+ save SIZEOF
- move.l a2,MN_REPLYPORT(a0)
- move.b #NT_MESSAGE,LN_TYPE(a0)
- subq #4,d2 subtract SIZEOF(SIZEOF)
- move.w d2,MN_LENGTH(a0)
- move.l a0,d0
- createio_e movem.l (sp)+,d2/a2
- rts
-
- deleteio move.l a0,d0 in: a0 = ioreq
- beq.s deleteio0 -> nothing to delete
- move.l a0,a1
- move.l -(a1),d0 get SIZEOF
- jsr _LVOFreeMem(a6)
- deleteio0 rts
-
- ** my input handler, on entry A0=input event, A1=private data
- myhandler
- movem.l a0/a2,-(sp)
- lea custom+dmacon,a2
- LOOPY move.b ie_Class(a0),d1
- cmp.b #IECLASS_TIMER,d1
- bne.s try_rawmouse
- move.l ie_TimeStamp(a0),d0 READ SECONDS COUNT
- tst.b first_time(a1)
- bne.s 2$
- move.l d0,last_ptr_secs(a1)
- move.l d0,last_scr_secs(a1)
- move.b #1,first_time(a1)
- 2$
- sub.l last_scr_secs(a1),d0 d0=timeelapsed in seconds
- cmp.l scr_secs(a1),d0
- blo.s bump_ptr_stuff
- move.w #0+DMAF_RASTER+DMAF_COPPER,(a2)
- clr.w color-dmacon(a2) SET BLACK SCREEN
- clr.l spr+sd_dataa-dmacon(a2) MAKE SURE SPRITE GOES
- move.b #1,SCblack(a1) set blackflag
- bump_ptr_stuff
- move.l ie_TimeStamp(a0),d0
- sub.l last_ptr_secs(a1),d0 d0=timeelapsed in seconds
- cmp.l ptr_secs(a1),d0
- blo.s quit_hdl
- move.w #0+$20,(a2) turn sprites off.
- clr.l spr+sd_dataa-dmacon(a2)
- move.b #1,PTblack(a1)
- quit_hdl move.l (a0),d0 get next event
- move.l d0,a0
- bne.s LOOPY
- movem.l (sp)+,a0/a2
- move.l a0,d0
- rts
- try_rawmouse
- cmp.b #IECLASS_RAWMOUSE,d1
- bne.s try_rawkey
- acc_x move.w ie_X(a0),d1 MOUSE ACCELERATION
- muls d1,d1
- tst.w ie_X(a0)
- bpl 1$
- neg.w d1
- 1$
- move.w d1,ie_X(a0)
- acc_y move.w ie_Y(a0),d1
- muls d1,d1
- tst.w ie_Y(a0)
- bpl 2$
- neg.w d1
- 2$
- move.w d1,ie_Y(a0)
- ptr_on move.w #$8000+$20,(a2) sprite on
- clr.b PTblack(a1)
- move.l ie_TimeStamp(a0),last_ptr_secs(a1)
- lites_on move.w #$8000+DMAF_RASTER+DMAF_COPPER,(a2) screen on
- clr.b SCblack(a1)
- move.l ie_TimeStamp(a0),last_scr_secs(a1)
- bra.s quit_hdl
- try_rawkey
- cmp.b #IECLASS_RAWKEY,d1
- beq.s lites_on
- bra.s quit_hdl
-
- endhandler
-
- **positions in code block
- codepos equ 0
- privatepos equ endhandler-myhandler
- intpos equ privatepos+SIZEOF_PS
-
- ** DATA
- ioreq dc.l 0
- msgport dc.l 0
- inputname dc.b 'input.device',0
-
- END
-