home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / ROM_Kernel_Manuals / Hard_examples / HAM_playfield.asm < prev    next >
Encoding:
Assembly Source File  |  1992-08-20  |  4.1 KB  |  92 lines

  1. ;
  2. ; HAM_playfield.asm
  3. ;
  4. ; The following example code generates a six-bitplane display with
  5. ; hold-and-modify mode turned on. All 32 color registers are loaded
  6. ; with black to prove that the colors are being generated by
  7. ; hold-and-modify. The equates are the usual and are not repeated here.
  8.  
  9. ;  First, set up the control registers.
  10. ;
  11.         LEA     CUSTOM,a0               ; Point a0 at custom chips
  12.         MOVE.W  #$6A00,BPLCON0(a0)      ; Six bitplanes, hold-and-modify mode
  13.         MOVE.W  #0,BPLCON1(a0)          ; Horizontal scroll = 0
  14.         MOVE.W  #0,BPL1MOD(a0)          ; Modulo for odd bitplanes = 0
  15.         MOVE.W  #0,BPL2MOD(a0)          ; Ditto for even bitplanes
  16.         MOVE.W  #$0038,DDFSTRT(a0)      ; Set data-fetch start
  17.         MOVE.W  #$00D0,DDFSTOP(a0)      ; Set data-fetch stop
  18.         MOVE.W  #$2C81,DIWSTRT(a0)      ; Set display window start
  19.         MOVE.W  #$F4C1,DIWSTOP(a0)      ; Set display window stop
  20. ;
  21. ;  Set all color registers = black to prove that hold-and-modify mode is working.
  22. ;
  23.         MOVE.W  #32,d0                  ; Initialize counter
  24.         LEA     CUSTOM+COLOR00,a1       ; Point a1 at first color register
  25. CREGLOOP:
  26.         MOVE.W  #$0000,(a1)+            ; Write black to a color register
  27.         DBRA    d0,CREGLOOP             ; Decrement counter and loop til done...
  28. ;
  29. ;  Fill six bitplanes with an easily recognizable pattern.
  30. ;
  31. ;  NOTE:  This is just for example use.  Normally these bitplanes would
  32. ;         need to be allocated from the system MEMF_CHIP memory pool.
  33. ;
  34.         MOVE.W  #2000,d0                ; 2000 longwords per bitplane
  35.         MOVE.L  #$21000,a1              ; Point a1 at bitplane 1
  36.         MOVE.L  #$23000,a2              ; Point a2 at bitplane 2
  37.         MOVE.L  #$25000,a3              ; Point a3 at bitplane 3
  38.         MOVE.L  #$27000,a4              ; Point a4 at bitplane 4
  39.         MOVE.L  #$29000,a5              ; Point a5 at bitplane 5
  40.         MOVE.L  #$2B000,a6              ; Point a6 at bitplane 6
  41. FPLLOOP:
  42.         MOVE.L  #$55555555,(a1)+        ; Fill bitplane 1 with $55555555
  43.         MOVE.L  #$33333333,(a2)+        ; Fill bitplane 2 with $33333333
  44.         MOVE.L  #$0F0F0F0F,(a3)+        ; Fill bitplane 3 with $0F0F0F0F
  45.         MOVE.L  #$00FF00FF,(a4)+        ; Fill bitplane 4 with $00FF00FF
  46.         MOVE.L  #$CF3CF3CF,(a5)+        ; Fill bitplane 5 with $CF3CF3CF
  47.         MOVE.L  #$3CF3CF3C,(a6)+        ; Fill bitplane 6 with $3CF3CF3C
  48.         DBRA    d0,FPLLOOP              ; Decrement counter and loop til done...
  49. ;
  50. ;  Set up a Copper list at $20000.
  51. ;
  52. ;  NOTE:  As with the bitplanes, the copper list location should be allocated
  53. ;         from the system MEMF_CHIP memory pool.
  54. ;
  55.         MOVE.L  #$20000,a1              ; Point a1 at Copper list destination
  56.         LEA     COPPERL(pc),a2          ; Point a2 at Copper list image
  57. CLOOP:  MOVE.L  (a2),(a1)+              ; Move a long word...
  58.         CMPI.L  #$FFFFFFFE,(a2)+        ; Check for end of Copper list
  59.         BNE     CLOOP                   ; Loop until entire Copper list moved
  60. ;
  61. ;  Point Copper at Copper list.
  62. ;
  63.         MOVE.L  #$20000,COP1LCH(a0)     ; Load Copper jump register
  64.         MOVE.W  COPJMP1(a0),d0          ; Force load into Copper P.C.
  65. ;
  66. ;  Start DMA.
  67. ;
  68.         MOVE.W  #$8380,DMACON(a0)       ; Enable bitplane and Copper DMA
  69.  
  70.         BRA     .....next stuff to do.....
  71. ;
  72. ;  Copper list for six bitplanes.  Bitplane 1 is at $21000; 2 is at $23000;
  73. ;  3 is at $25000; 4 is at $27000; 5 is at $29000; 6 is at $2B000.
  74. ;
  75. ;  NOTE:  These bitplane addresses are for example purposes only.
  76. ;         See note above.
  77. ;
  78. COPPERL:
  79.         DC.W    BPL1PTH,$0002   ; Bitplane 1 pointer = $21000
  80.         DC.W    BPL1PTL,$1000
  81.         DC.W    BPL2PTH,$0002   ; Bitplane 2 pointer = $23000
  82.         DC.W    BPL2PTL,$3000
  83.         DC.W    BPL3PTH,$0002   ; Bitplane 3 pointer = $25000
  84.         DC.W    BPL3PTL,$5000
  85.         DC.W    BPL4PTH,$0002   ; Bitplane 4 pointer = $27000
  86.         DC.W    BPL4PTL,$7000
  87.         DC.W    BPL5PTH,$0002   ; Bitplane 5 pointer = $29000
  88.         DC.W    BPL5PTL,$9000
  89.         DC.W    BPL6PTH,$0002   ; Bitplane 6 pointer = $2B000
  90.         DC.W    BPL6PTL,$B000
  91.         DC.W    $FFFF,$FFFE     ; Wait for the impossible, i.e., quit
  92.