home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 95 / af095sub.adf / MBlank.LZX / MBlank / Test.blm.asm < prev   
Assembly Source File  |  2011-05-06  |  3KB  |  100 lines

  1.     ttl 'Save blanker module'
  2.  
  3.          incdir    "Includes:"
  4.         include    "exec/funcdef.i"
  5.         include "exec/memory.i"
  6.         include    "dos/dosextens.i"
  7.         include "dos/dos_lib.i"
  8.         include    "exec/exec_lib.i"
  9.         include "intuition/intuition.i"
  10.         include "intuition/intuition_lib.i"
  11.         include "graphics/displayinfo.i"
  12.         include "graphics/gfx.i"
  13.         include "graphics/graphics_lib.i"
  14.         include    "libraries/commodities.i"
  15.         include    "workbench/startup.i"
  16.         include    "workbench/workbench.i"
  17.  
  18.         include "module.i"
  19.  
  20.         bra    DataSave
  21.  
  22. module_name    dc.b "Test.blm",0
  23.  
  24.         cnop 0,4
  25. blm_start    ds.b    blm_SIZEOF        ;see 'module.i'
  26. ;insert your taglist or whatever here
  27.  
  28.         cnop 0,4
  29. codeentry    EQU    *-blm_start        ;needs to be a relative
  30.  
  31. ; Insert position-independant code here:
  32. ;     a5    =    APTR AllGlobals (need not be saved)
  33. ;--------------------------------------------------------------------------
  34. ;Code for external module for Blanker of type 'BLMS'
  35.  
  36. Blank        
  37. BlankLoop    btst    #GB_BLANK,gb_Flags(a5)    ;test blank-flag
  38.         beq    ExitBlank
  39.  
  40. ; Perform any action you want here!!! Use Wait(gb_ResetSignal) whenever
  41. ; you can! Task will get a signal (gb_ResetSignal) on reset(if GB_BLANK
  42. ; is SET)
  43. ;        move.l    gb_ResetSignal(a5),d0    ;wait for reset-signal
  44. ;        CALLEXEC Wait
  45.  
  46.         move.w    d0,$dff180
  47.         addq    #2,d0
  48.         bra.s    BlankLoop
  49.  
  50. ExitBlank    moveq    #TRUE,d0        ;OK
  51.  
  52. ;bra to BLNKexitFALSE with a BEQ-condition(zero-flag set) to let
  53. ;'Black-Screen' do the blanking.
  54. BLNKexitFALSE    rts                ;exit module
  55.  
  56.  
  57. ;--------------------------------------------------------------------------
  58. ; Here it should be finished
  59.         cnop 0,4
  60.  
  61. modulesize    EQU    *-blm_start
  62.  
  63. ; Data_saver: saves code as a data-block to a file,
  64. ; code starts at buffer
  65.  
  66. DataSave    lea    blm_start(pc),a0
  67.         move.l    #modulesize,blm_Length(a0)    ;module.i
  68.         move.l    #codeentry,blm_Code(a0)        ;module.i
  69.         move.l    #'BLMS',blm_ID(a0)        ;module.i
  70.         
  71. Openl        move.l    #4,a6            ;Open dos.library
  72.         move.l    (a6),a6
  73.         move.l    #37,d0            ;Version 37 min.
  74.         lea    libname,a1
  75.         jsr    -552(a6)
  76.         move.l    d0,a5
  77.         beq    exit            ;If enable to open, exit
  78. usel        move.l    a5,a6
  79.         lea    module_name,a0
  80.         move.l    a0,d1            ;Point at name
  81.         move.l    #1006,d2        ;Open new file-modus
  82.         jsr    -30(a6)            ;Open functie in Dos.lib
  83.         move.l    d0,a4            ;store handle(ID) for later use
  84.         beq    Closel            ;Unable to open file
  85.         move.l    a4,d1            ;file-ID
  86.         lea    blm_start,a0
  87.         move.l    a0,d2            ;Data to write to file
  88.         move.l    #modulesize,d3        ;number of bytes
  89.         jsr     -48(a6)            ;Write functie in Dos.lib
  90. closef        move.l    a4,d1            ;Close file!
  91.         jsr    -36(a6)
  92.         
  93. Closel      move.l    #4,a6
  94.         move.l    (a6),a6        
  95.         move.l    a5,a1            ;Close dos.library
  96.         jsr    -414(a6)
  97. exit        rts    
  98.  
  99. libname        dc.b "dos.library",0
  100.