home *** CD-ROM | disk | FTP | other *** search
- *************************************
- * AlertTimer - alert timing utility *
- * (C) SinSoft 1993 *
- *************************************
-
- ;Include files not needed to assembly this program
- ;Use almost any 68K assembler
-
- move.l 4.w,a6 ;get execbase
- cmpi.w #39,$14(a6) ;LIB_VERSION compared
- bcs.s failure ;we aren't running under 3.0
- moveq #4,d0 ;dos.library tag number
- jsr -810(a6) ;OpenTaggedLibrary function called
- move.l a6,a5 ;execbase stored
- move.l d0,a6 ;dos will be used
- tst.l d0
- bne.s dosok ;library opened OK
- failure moveq #20,d0 ;return code
- rts ;bye
- dosok clr.l -(sp)
- clr.l -(sp) ;workspace on the stack made
- lea intemp(pc),a0 ;input template addr
- move.l a0,d1 ;to be pc-relative
- move.l sp,d2 ;our space
- clr.l d3
- jsr -$31e(a6) ;ReadArgs function called
- move.l d0,d7 ;remeber this to free args later
- bne.s ok ;Arguments ok
- jsr -132(a6) ;IoErr function called - error determined
- move.l d0,d1 ;error code
- move.l d3,d2
- jsr -$1da(a6) ;PrintFault function called
- bra.s clodos ;we can't do anything more
- ok lea primes(pc),a1 ;address of primary message
- move.l a1,d1 ;to be PC-relative
- jsr -$3ba(a6) ;Printf function called
- lea $20e(a5),a3 ;address of timing variable
- clr.w d6
- move.b $212(a5),d6 ;VBlank frequency as a word fetched
- tst.l (sp)
- beq.s nonum ;timing value not specified
- move.l (sp),a1 ;Address of the value
- move.l (a1),d0 ;Value itself
- move.l d0,(sp) ;stored for the message
- mulu d6,d0 ;multiplied by VBlank
- move.l d0,(a3) ;and stored to execbase for use by Alert()
-
- printit lea curmes(pc),a1 ;message address
- print2 move.l a1,d1 ;to be pc-relative
- move.l sp,d2 ;arguments
- jsr -$3ba(a6) ;Printf function called
-
- move.l d7,d1 ;Argument address
- jsr -$35a(a6) ;FreeArgs function called
-
- clodos move.l a6,a1 ;dosbase as an argument to CloseLibrary()
- move.l a5,a6 ;execbase reactivated
- jsr -414(a6) ;CloseLibrary function called
- moveq #0,d0
- lea 8(sp),sp ;space discarded
- rts
-
- nonum tst.l 4(sp)
- beq.s query ;OFF switch unspecified
- moveq #-1,d0
- move.l d0,(a3) ;store -1 as an OFF value
- turnof lea curmes2(pc),a1 ;message address
- bra.s print2
-
- query move.l (a3),d0 ;get current value
- addq.l #1,d0
- beq.s turnof ;it is -1 - tell it
- subq.l #1,d0
- divu d6,d0 ;convert to seconds
- andi.l #$ffff,d0 ;ignore remainder
- move.l d0,(sp) ;store the value
- bra.s printit
-
- intemp dc.b 'TIMING/N,OFF/S',0
- primes dc.b 'Alert timing is ',0
- curmes dc.b 'set to %ld seconds.',10,0
- curmes2 dc.b 'turned off.',10,0
- dc.b '$VER: alerttimer 39.1 (10.1.93)',0
-
- end
-