home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / tcs / examples / sources / rmpilbm.s < prev    next >
Encoding:
Text File  |  2000-06-26  |  3.8 KB  |  124 lines

  1. *******************************************************************************
  2. * ILBM loading and remapping example
  3. *******************************************************************************
  4. * INFO    loads a 320x256x8 ILBM with a non-RGBx palette and remaps it
  5. *    to a FullRes screen
  6. * NOTE    - optionally you can pass as CLI argument the name of the
  7. *      320x256x8 IFF/ILBM to load (if not one of those supplied in
  8. *      TCS/examples/pix/, make sure that yours is exactly 320x256x8
  9. *      and that it respects all the restrictions of TCS_LdILBM(),
  10. *      otherwise the program won't execute or the graphics will
  11. *      look bad - not dangerous, anyway!)
  12. *    - LMB to quit
  13. *******************************************************************************
  14.  
  15.     machine    68020
  16.  
  17.     include    INCLUDES:libraries/tcs.i
  18.     include    INCLUDES:libraries/tcs_lib.i
  19.  
  20.  
  21.  
  22. *******************************************************************************
  23. * definitions
  24. *******************************************************************************
  25.  
  26. DSPLWD    =    320    ;our TCS display width and
  27. DSPLHT    =    256    ;height in 140 ns pixels
  28. SCRWD    =    320    ;TCS screen width and
  29. SCRHT    =    256    ;height in pixels
  30. DSPLX0    =    $81*4    ;display start
  31. DSPLY0    =    $2c    ;position (SHRES pixels)
  32. DSPLX1    =    DSPLX0+DSPLWD*4    ;display end
  33. DSPLY1    =    DSPLY0+DSPLHT    ;position (SHRES pixels)
  34. DSPLBRTNS    =    256    ;min brightness
  35. GFXCTXT    =    0
  36. CWBTM    =    0
  37. CWTOP    =    0
  38. CWRT    =    0
  39. CWLF    =    0
  40. VDOMODE    =    TCS_VM_RGBW | TCS_VMf_FullRes ;TCS display video mode
  41.  
  42. ARGSNO    =    1    ;command line arguments no.
  43.  
  44.  
  45.  
  46. *******************************************************************************
  47. * code start
  48. *******************************************************************************
  49.  
  50.     include    /includes/macros.i
  51.     include    /includes/shl_strtup.i
  52.  
  53.  
  54.  
  55. *******************************************************************************
  56. * init
  57. *******************************************************************************
  58.  
  59. _PrgInit    movea.l    CmdLnArgs,a0    ;ILBM filename address
  60.     tst.l    a0
  61.     bne.s    .ld    ;if filename specified...
  62.     lea.l    PicFlNm,a0    ;default ILBM
  63. .ld    movea.l    ([DIAdr.l],TCS_DI_CSAdr.w),a1 ;directly to
  64.     move.l    #SCRWD*SCRHT,d0    ;screen buffer
  65.     CALLTCS    LdILBM    ;load it
  66.     cmpi.l    #TCS_PE_OK,d0    ;success?
  67.     blo.s    .fail    ;if not...
  68.     move.l    d0,ILBMStrcAdr    ;else store its ILBM structure address
  69.     rts        ;& clr ccr.Z to signal success
  70. .fail    move.w    #4,ccr    ;signal error
  71.     rts
  72.  
  73.  
  74.  
  75. *******************************************************************************
  76. * main
  77. *******************************************************************************
  78.  
  79. _PrgMain    movea.l    ILBMStrcAdr,a3    ;get ILBM structure address
  80.  
  81.     movea.l    DIAdr,a0
  82. ;    move.b    (TCS_II_RGBxMode,a0),d0    ;get suggested RGBx mode
  83.     move.b    #TCS_VM_RGB332,d0    ;(but TCS_CLUTPicToRGBx() doesn't support all modes)
  84.     move.w    #256,d1
  85.     CALLTCS    SetRGBxMode
  86.  
  87.     movea.l    (TCS_II_GfxAdr,a3),a1    ;get address of ILBM's graphic data
  88.     movea.l    (TCS_II_PalAdr,a3),a2    ;get address of ILBM's palette (CLUT)
  89. ;    move.b    (TCS_II_RGBxMode,a3),d0    ;get suggested RGBx mode
  90.     move.b    #TCS_VM_RGB332,d0    ;(but TCS_CLUTPicToRGBx() doesn't support all modes)
  91.     move.w    #SCRWD,d1
  92.     move.w    #SCRHT,d2
  93.     movea.l    a1,a0    ;source & destination are the same!
  94.     CALLTCS    CLUTPicToRGBx    ;convert to RGBx
  95.  
  96.     movea.l    DIAdr,a0    ;render FullRes screen
  97.     CALLTCS    CPUFRPass0    ;to make pixels visible
  98.  
  99.     WTLMB
  100.     rts
  101.  
  102.  
  103.  
  104. *******************************************************************************
  105. * cleanup
  106. *******************************************************************************
  107.  
  108. _PrgClnUp    movea.l    ILBMStrcAdr,a0    ;free all the memory
  109.     CALLTCS    UnLdILBM    ;allocated for the ILBM
  110.     rts
  111.  
  112.  
  113.  
  114. *******************************************************************************
  115. * data
  116. *******************************************************************************
  117.  
  118.     include    /includes/dat.i
  119.  
  120.     cnop    0,4
  121. ILBMStrcAdr    dc.l    0    ;ILBM structure pointer
  122. tmplt    dc.b    "ILBM/K",0    ;template for ReadArgs()
  123. PicFlNm    dc.b    "/pix/Alphonse.iff",0    ;default ILBM
  124.