Guest User

Untitled

a guest
Sep 7th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; NOTES: This routine is loaded in VBlank, and all of the image data
  2. ; is uncompressed. $FFFFFB20 is the palette buffer.
  3.  
  4.  
  5. dma68kToVDP macro source,dest,length,type
  6.     lea ($C00004).l,a5
  7.     move.l  #(($9400|((((length)>>1)&$FF00)>>8))<<16)|($9300|(((length)>>1)&$FF)),(a5)
  8.     move.l  #(($9600|((((source)>>1)&$FF00)>>8))<<16)|($9500|(((source)>>1)&$FF)),(a5)
  9.     move.w  #$9700|(((((source)>>1)&$FF0000)>>16)&$7F),(a5)
  10.     move.w  #((dest)&$3FFF)|((type&1)<<15)|$4000,(a5)
  11.     move.w  #$80|(((dest)&$C000)>>14)|((type&2)<<3),($FFFFF640).w
  12.     move.w  ($FFFFF640).w,(a5)
  13.     endm
  14.     ; values for the type argument
  15. VRAM    =   $0
  16. CRAM    =   $1
  17. VSRAM   =   $2
  18.  
  19. Animation_Title:
  20. ;Subrutina para mostrar una imagen en Plano A, usando la segunda línea de paleta.
  21.  
  22. ;D0 dato cargado de las definiciones / Temporal
  23. ;D1 dato cargado de las definiciones / Temporal
  24. ;D2 Registro temporal
  25. ;A0 address de definiciones de frame
  26. ;A1 dato cargado de las definiciones
  27. ;A2 address temporal
  28. ;$FFFF7E00 Numero de frame
  29. ;$FFFF7E02 Timming
  30.  
  31.         moveq   #0,d0
  32.         moveq   #0,d1
  33.         moveq   #0,d2
  34.         moveq   #0,d3
  35.         moveq   #0,d4
  36.         moveq   #0,d5
  37.         moveq   #0,d6
  38.         ; Detectar address del frame a mostrar
  39.         tst.w   ($FFFF7E02).l
  40.         beq @_cn
  41.         sub.w   #1,($FFFF7E02).l
  42.         rts
  43.     @_cn:   lea (@Anim_Table).l,a0
  44.         move.w  ($FFFF7E00).l,d0
  45.         lsl.w   #2,d0
  46.         adda.w  d0,a0
  47.         movea.l (a0),a0
  48.         ; Cargar frames a esperar y cual sigue
  49.         move.b  (a0)+,d0
  50.         move.w  d0,($FFFF7E02).l
  51.         move.b  (a0)+,d0
  52.         move.w  d0,($FFFF7E00).l
  53.         ; Cargar Arte
  54.         move.l  (a0)+,($C00004).l
  55.         movea.l (a0)+,a1
  56.         move.l  (a0)+,d0
  57.         lsr.w   #1,d0
  58.         lea ($FF0000).l,a2
  59.     @_l1:   ;move.w (a1)+,($C00000).l
  60.         move.w  (a1)+,(a2)+
  61.         dbf d0,@_l1
  62.         dma68kToVDP $FFFF0000,$0C00,$3000,VRAM
  63.         ; Cargar Mapas
  64.         lea ($FF0000).l,a2
  65.         movea.l (a0)+,a1
  66.         move.l  (a0)+,d0
  67.         move.l  (a0)+,d2
  68.     @_l3:   move.w  (a1)+,d1
  69.         add.w   d2,d1
  70.         move.w  d1,(a2)+
  71.         dbf d0, @_l3
  72.         lea ($FF0000).l,a1
  73.         move.l  #$40000003,d0
  74.         moveq   #(((320)/8)-1),d1
  75.         moveq   #(((240)/8)-1),d2
  76.         jsr ShowVDPGraphics2
  77.         ; Cargar Paleta
  78.         movea.l (a0)+,a1
  79.         move.l  (a0)+,d0
  80.         lea ($FFFFFB20).l,a2
  81.     @_l2:   move.b  (a1)+,(a2)+
  82.         dbf d0,@_l2
  83.         rts
  84.         ; ^ Crear script de animación, que funcione con DMA
  85.         ; Vamos que se pueden poner los tres frames en VRAM.
  86.  
  87. @Anim_Table:   
  88.         dc.l    @Frame1
  89.         dc.l    @Frame2
  90.  
  91. @Frame1:    dc.b    $7,1                                    ;Frames a esperar, y cual sigue
  92.         dc.l    $4C000000, Art_MadTTL_1, (Art_MadTTL_1_End-Art_MadTTL_1)        ;Ubicación y tamaño del arte
  93.         dc.l    Map_MadTTL_1, (Map_MadTTL_1_End-Map_MadTTL_1), $2060            ;Ubicación en VRAM (/$20) de arte y tamaño de maps
  94.         dc.l    Pal_MadTTL_1, 31                            ;Ubicación en ROM y tamaño de paleta
  95.  
  96. @Frame2:    dc.b    $7,0                                    ;Frames a esperar, y cual sigue
  97.         dc.l    $4C000000, Art_MadTTL_2, (Art_MadTTL_2_End-Art_MadTTL_2)        ;Ubicación y tamaño del arte
  98.         dc.l    Map_MadTTL_2, (Map_MadTTL_2_End-Map_MadTTL_2), $2060            ;Ubicación en VRAM (/$20) de arte y tamaño de maps
  99.         dc.l    Pal_MadTTL_2, 31                            ;Ubicación en ROM y tamaño de paleta
  100.  
  101. ShowVDPGraphics2:
  102.  
  103.         lea ($FF0960).l,a6
  104.         lea (a6),a5
  105.     ;   move.l  #$800000,d4
  106.         move.l  #$80,d4
  107.  
  108. loc_142C_2:
  109.     ;   move.l  d0,4(a6)
  110.         move.w  d1,d3
  111.  
  112. loc_1432_2:
  113.         move.w  (a1)+,(a6)+
  114.         dbf d3,loc_1432_2
  115.     ;   add.l   d4,d0
  116.         adda.l  d4,a5
  117.         lea (a5),a6
  118.         dbf d2,loc_142C_2
  119.         dma68kToVDP $FFFF0960,$C000,$1000,VRAM
  120.         rts
Add Comment
Please, Sign In to add comment