Advertisement
Yesideez

AlertSC.s v0.02 (03-Oct-2015)

Jul 8th, 2020
4,242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;$VER: AlertSC.s v0.02 (03-Oct-2015)
  2. ;Code by Zeb/Slipstream
  3.  
  4.     incdir  'coding:includes'
  5.     include 'dos/dos.i'
  6.     include 'intuition/intuition.i'
  7.     include 'lvo/dos_lvo.i'
  8.     include 'lvo/intuition_lvo.i'
  9.     include 'lvo/exec_lvo.i'
  10.  
  11.     output  coding:source/alertsc/AlertSC
  12.  
  13.     opt o+,w-
  14.     section progcode,code
  15.  
  16. ProgStart
  17.     bra.b   .start
  18.     dc.b    '$VER: AlertSC v0.02 (03-Oct-2015)',0
  19.     even
  20.  
  21. .start  movem.l a0/d0,-(sp)
  22.  
  23.     moveq   #0,d7           ;Convert string to a number (any
  24.     move.b  (a0),d7         ;validation checks will be later)
  25.     cmp.b   #'?',(a0)
  26.     beq.b   .skip
  27.     sub #$30,d7
  28. .skip   move.l  d7,seconds
  29.  
  30.     lea dosBase(pc),a1      ;Open: dos.library
  31.     moveq.l #0,d0
  32.     bsr OpenLibrary
  33.     tst.l   d0
  34.     beq Error_Opening_dos
  35.     move.l  d0,dosBase
  36.  
  37.     move.l  d0,a6           ;Get stdio
  38.     jsr _LVOOutput(a6)
  39.     tst.l   d0
  40.     beq Error_NoOutput
  41.     move.l  d0,StdOut
  42.  
  43.     lea intBase(pc),a1      ;Open: intuition.library v39
  44.     moveq.l #39,d0
  45.     bsr OpenLibrary
  46.     tst.l   d0
  47.     beq Error_Opening_Intuition
  48.     move.l  d0,intBase
  49.  
  50.     move.l  seconds,d0      ;Validate the seconds value
  51.     cmp.l   #'?',d0         ;Show usage if asked
  52.     beq ShowUsageText
  53.     cmp.b   #0,d7
  54.     blt Error_InvalidSeconds
  55.     cmp.b   #9,d7
  56.     bgt Error_InvalidSeconds
  57.  
  58.     mulu    #50,d0          ;Convert to ticks
  59.     move.l  d0,a1
  60.     bsr TimedDisplayAlert
  61.     tst.l   d0
  62.     beq.b   .rmb
  63. .lmb    move.l  #5,ReturnCode       ;left mouse
  64.     bra.b   CloseIntuitionLibrary
  65. .rmb    move.l  #0,ReturnCode       ;right mouse
  66.  
  67. CloseIntuitionLibrary
  68.     move.l  intBase(pc),a1      ;Close: intuition.library
  69.     bsr CloseLibrary
  70. CloseDosLibrary
  71.     move.l  dosBase(pc),a1      ;Close: dos.library
  72.     bsr CloseLibrary
  73. Quit    movem.l (sp)+,a0/d0
  74.     move.l  ReturnCode(pc),d0   ;Set our return code value
  75.     rts
  76.  
  77. Error_Opening_dos
  78.     move.l  #20,ReturnCode
  79.     bra Quit
  80.    
  81. Error_Opening_Intuition
  82.     lea NeedIntuition39(pc),a2
  83.     bsr Write
  84.     move.l  #20,ReturnCode
  85.     bra CloseDosLibrary
  86.  
  87. Error_InvalidSeconds
  88.     lea InvalidSeconds(pc),a2
  89.     bsr Write
  90.     move.l  #20,ReturnCode
  91.     bra CloseIntuitionLibrary
  92.  
  93. Error_NoOutput
  94.     move.l  #20,ReturnCode
  95.     bra CloseDosLibrary
  96.  
  97. ShowUsageText
  98.     lea Usage(pc),a2
  99.     bsr Write
  100.     move.l  #20,ReturnCode
  101.     bra CloseIntuitionLibrary
  102.  
  103. ;***************************************************************************
  104. ;** exec.library
  105.  
  106. OpenLibrary
  107.     move.l  4.w,a6
  108.     jmp _LVOOpenLibrary(a6)
  109.  
  110. CloseLibrary
  111.     move.l  4.w,a6
  112.     jmp _LVOCloseLibrary(a6)
  113.  
  114. ;***************************************************************************
  115. ;** dos.library
  116.  
  117. Write
  118.     move.l  dosBase(pc),a6
  119.     move.l  StdOut(pc),d1
  120.     move.l  a2,d2
  121.     moveq.l #0,d3
  122. .loop   tst.b   (a2)+
  123.     beq.b   .eol
  124.     addq.l  #1,d3
  125.     bra.b   .loop
  126. .eol    jmp _LVOWrite(a6)
  127.  
  128. ;***************************************************************************
  129. ;** intuition.library
  130.  
  131. TimedDisplayAlert       ;a1=delay (seconds*50)
  132.     move.l  intBase(pc),a6
  133.     move.l  #RECOVERY_ALERT,d0
  134.     lea AlertText(pc),a0
  135.     moveq.l #56,d1      ;height
  136.     cmp.l   #0,a1
  137.     bne .timed
  138.     jmp _LVODisplayAlert(a6)
  139. .timed  jmp -$336(a6)   ;_LVOTimedDisplayAlert(a6)
  140.  
  141. ;***************************************************************************
  142.  
  143. dosBase DOSNAME
  144.     even
  145. intBase dc.b    'intuition.library',0
  146.     even
  147. ReturnCode
  148.     dc.l    0
  149. StdOut  dc.l    0
  150. seconds dc.l    0
  151. Usage   dc.b    $9b,'0;1mAlertSC v0.02 by Zeb/Slipstream (03-Oct-2015)',$9b,'0m',$a,$a
  152.     dc.b    'Usage: AlertSC <seconds>',$a,$a
  153.     dc.b    'If 0 seconds is used for the requester will not time out.',$a
  154.     dc.b    'The limit for seconds must be between 0 and 9',$a,0
  155.     even
  156. NeedIntuition39
  157.     dc.b    'AlertSC: Unable to open intuition.library v39',$a,0
  158.     even
  159. InvalidSeconds
  160.     dc.b    'AlertSC: Seconds must be between 0 and 9',$a,0
  161.     even
  162. AlertText
  163.     dc.b    0,140,20,'AlertSC v0.02 by Zeb/Slipstream (03-Oct-2015)',0,1
  164.     dc.b    0,140,21,'_____________________________________________',0,1
  165.     dc.b    0,144,21,'____________________________________________',0,1
  166.     dc.b    0,52,40,'Press left mouse for Kickstart 3.1 or right mouse for Kickstart 3.1',0,1
  167.     dc.b    0,68,40,'Press left mouse for AmigaDOS menu or right mouse for Workbench',0,0
  168. ;   dc.b    0,8,40,'123456789012345678901234567890123456789012345678901234567890123456789012345678',0,0
  169.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement