Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;$VER: AlertSC.s v0.02 (03-Oct-2015)
- ;Code by Zeb/Slipstream
- incdir 'coding:includes'
- include 'dos/dos.i'
- include 'intuition/intuition.i'
- include 'lvo/dos_lvo.i'
- include 'lvo/intuition_lvo.i'
- include 'lvo/exec_lvo.i'
- output coding:source/alertsc/AlertSC
- opt o+,w-
- section progcode,code
- ProgStart
- bra.b .start
- dc.b '$VER: AlertSC v0.02 (03-Oct-2015)',0
- even
- .start movem.l a0/d0,-(sp)
- moveq #0,d7 ;Convert string to a number (any
- move.b (a0),d7 ;validation checks will be later)
- cmp.b #'?',(a0)
- beq.b .skip
- sub #$30,d7
- .skip move.l d7,seconds
- lea dosBase(pc),a1 ;Open: dos.library
- moveq.l #0,d0
- bsr OpenLibrary
- tst.l d0
- beq Error_Opening_dos
- move.l d0,dosBase
- move.l d0,a6 ;Get stdio
- jsr _LVOOutput(a6)
- tst.l d0
- beq Error_NoOutput
- move.l d0,StdOut
- lea intBase(pc),a1 ;Open: intuition.library v39
- moveq.l #39,d0
- bsr OpenLibrary
- tst.l d0
- beq Error_Opening_Intuition
- move.l d0,intBase
- move.l seconds,d0 ;Validate the seconds value
- cmp.l #'?',d0 ;Show usage if asked
- beq ShowUsageText
- cmp.b #0,d7
- blt Error_InvalidSeconds
- cmp.b #9,d7
- bgt Error_InvalidSeconds
- mulu #50,d0 ;Convert to ticks
- move.l d0,a1
- bsr TimedDisplayAlert
- tst.l d0
- beq.b .rmb
- .lmb move.l #5,ReturnCode ;left mouse
- bra.b CloseIntuitionLibrary
- .rmb move.l #0,ReturnCode ;right mouse
- CloseIntuitionLibrary
- move.l intBase(pc),a1 ;Close: intuition.library
- bsr CloseLibrary
- CloseDosLibrary
- move.l dosBase(pc),a1 ;Close: dos.library
- bsr CloseLibrary
- Quit movem.l (sp)+,a0/d0
- move.l ReturnCode(pc),d0 ;Set our return code value
- rts
- Error_Opening_dos
- move.l #20,ReturnCode
- bra Quit
- Error_Opening_Intuition
- lea NeedIntuition39(pc),a2
- bsr Write
- move.l #20,ReturnCode
- bra CloseDosLibrary
- Error_InvalidSeconds
- lea InvalidSeconds(pc),a2
- bsr Write
- move.l #20,ReturnCode
- bra CloseIntuitionLibrary
- Error_NoOutput
- move.l #20,ReturnCode
- bra CloseDosLibrary
- ShowUsageText
- lea Usage(pc),a2
- bsr Write
- move.l #20,ReturnCode
- bra CloseIntuitionLibrary
- ;***************************************************************************
- ;** exec.library
- OpenLibrary
- move.l 4.w,a6
- jmp _LVOOpenLibrary(a6)
- CloseLibrary
- move.l 4.w,a6
- jmp _LVOCloseLibrary(a6)
- ;***************************************************************************
- ;** dos.library
- Write
- move.l dosBase(pc),a6
- move.l StdOut(pc),d1
- move.l a2,d2
- moveq.l #0,d3
- .loop tst.b (a2)+
- beq.b .eol
- addq.l #1,d3
- bra.b .loop
- .eol jmp _LVOWrite(a6)
- ;***************************************************************************
- ;** intuition.library
- TimedDisplayAlert ;a1=delay (seconds*50)
- move.l intBase(pc),a6
- move.l #RECOVERY_ALERT,d0
- lea AlertText(pc),a0
- moveq.l #56,d1 ;height
- cmp.l #0,a1
- bne .timed
- jmp _LVODisplayAlert(a6)
- .timed jmp -$336(a6) ;_LVOTimedDisplayAlert(a6)
- ;***************************************************************************
- dosBase DOSNAME
- even
- intBase dc.b 'intuition.library',0
- even
- ReturnCode
- dc.l 0
- StdOut dc.l 0
- seconds dc.l 0
- Usage dc.b $9b,'0;1mAlertSC v0.02 by Zeb/Slipstream (03-Oct-2015)',$9b,'0m',$a,$a
- dc.b 'Usage: AlertSC <seconds>',$a,$a
- dc.b 'If 0 seconds is used for the requester will not time out.',$a
- dc.b 'The limit for seconds must be between 0 and 9',$a,0
- even
- NeedIntuition39
- dc.b 'AlertSC: Unable to open intuition.library v39',$a,0
- even
- InvalidSeconds
- dc.b 'AlertSC: Seconds must be between 0 and 9',$a,0
- even
- AlertText
- dc.b 0,140,20,'AlertSC v0.02 by Zeb/Slipstream (03-Oct-2015)',0,1
- dc.b 0,140,21,'_____________________________________________',0,1
- dc.b 0,144,21,'____________________________________________',0,1
- dc.b 0,52,40,'Press left mouse for Kickstart 3.1 or right mouse for Kickstart 3.1',0,1
- dc.b 0,68,40,'Press left mouse for AmigaDOS menu or right mouse for Workbench',0,0
- ; dc.b 0,8,40,'123456789012345678901234567890123456789012345678901234567890123456789012345678',0,0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement