home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK3 / DFUE_100 / FAMISRC.ZIP / GIF2SOPT.ZIP / TEST.SRC < prev   
Text File  |  1993-11-24  |  6KB  |  188 lines

  1. ; assemble at $8000
  2.     org $8000
  3.  
  4. ; program start
  5. start
  6.     sei             ; disable interrupts
  7.     phk             ; push current bank on stack
  8.     plb             ; pop it off the stack and make it the current programming bank
  9.     clc
  10.     xce             ; native 16-bit mode
  11.  
  12. ; initialise SNES
  13.     sep #$30        ; make X, Y, A all 8-bits
  14.     lda #$80        ; screen off, no brightness
  15.     sta $2100       ; brightness & screen enable register
  16.     lda #$00
  17.     sta $2101       ; sprite register (size & address in VRAM)
  18.     sta $2102       ; sprite registers (address of sprite memory [OAM])
  19.     sta $2103       ; sprite registers (address of sprite memory [OAM])
  20.     sta $2105       ; graphic mode register
  21.     sta $2106       ; mosaic register
  22.     sta $2107       ; plane 0 map VRAM location
  23.     sta $2108       ; plane 1 map VRAM location
  24.     sta $2109       ; plane 2 map VRAM location
  25.     sta $210A       ; plane 3 map VRAM location
  26.     sta $210B       ; plane 0 & 1 Tile data location
  27.     sta $210C       ; plane 2 & 3 Tile data location
  28.     sta $210D       ; plane 0 scroll x (first 8 bits)
  29.     sta $210D       ; plane 0 scroll x (last 3 bits)
  30.     sta $210E       ; plane 0 scroll y (first 8 bits)
  31.     sta $210E       ; plane 0 scroll y (last 3 bits)
  32.     sta $210F       ; plane 1 scroll x (first 8 bits)
  33.     sta $210F       ; plane 1 scroll x (last 3 bits)
  34.     sta $2110       ; plane 1 scroll y (first 8 bits)
  35.     sta $2110       ; plane 1 scroll y (last 3 bits)
  36.     sta $2111       ; plane 2 scroll x (first 8 bits)
  37.     sta $2111       ; plane 2 scroll x (last 3 bits)
  38.     sta $2112       ; plane 2 scroll y (first 8 bits)
  39.     sta $2112       ; plane 2 scroll y (last 3 bits)
  40.     sta $2113       ; plane 3 scroll x (first 8 bits)
  41.     sta $2113       ; plane 3 scroll x (last 3 bits)
  42.     sta $2114       ; plane 3 scroll y (first 8 bits)
  43.     sta $2114       ; plane 3 scroll y (last 3 bits)
  44.     lda #$80        ; increase VRAM address after writing to $2119
  45.     sta $2115       ; VRAM address increment register
  46.     lda #$00
  47.     sta $2116       ; VRAM address low
  48.     sta $2117       ; VRAM address high
  49.     sta $211A       ; initial mode 7 setting register
  50.     sta $211B       ; mode 7 matrix parameter A register (low)
  51.     lda #$01
  52.     sta $211B       ; mode 7 matrix parameter A register (high)
  53.     lda #$00
  54.     sta $211C       ; mode 7 matrix parameter B register (low)
  55.     sta $211C       ; mode 7 matrix parameter B register (high)
  56.     sta $211D       ; mode 7 matrix parameter C register (low)
  57.     sta $211D       ; mode 7 matrix parameter C register (high)
  58.     sta $211E       ; mode 7 matrix parameter D register (low)
  59.     lda #$01
  60.     sta $211E       ; mode 7 matrix parameter D register (high)
  61.     lda #$00
  62.     sta $211F       ; mode 7 center position X register (low)
  63.     sta $211F       ; mode 7 center position X register (high)
  64.     sta $2120       ; mode 7 center position Y register (low)
  65.     sta $2120       ; mode 7 center position Y register (high)
  66.     sta $2121       ; color number register ($00-$ff)
  67.     sta $2123       ; bg1 & bg2 window mask setting register
  68.     sta $2124       ; bg3 & bg4 window mask setting register
  69.     sta $2125       ; obj & color window mask setting register
  70.     sta $2126       ; window 1 left position register
  71.     sta $2127       ; window 2 left position register
  72.     sta $2128       ; window 3 left position register
  73.     sta $2129       ; window 4 left position register
  74.     sta $212A       ; bg1, bg2, bg3, bg4 window logic register
  75.     sta $212B       ; obj, color window logic register (or, and, xor, xnor)
  76.     lda #$01
  77.     sta $212C       ; main screen designation (planes, sprites enable)
  78.     lda #$00
  79.     sta $212D       ; sub screen designation
  80.     sta $212E       ; window mask for main screen
  81.     sta $212F       ; window mask for sub screen
  82.     lda #$30
  83.     sta $2130       ; color addition & screen addition init setting
  84.     lda #$00
  85.     sta $2131       ; add/sub sub designation for screen, sprite, color
  86.     lda #$E0
  87.     sta $2132       ; color data for addition/subtraction
  88.     lda #$00
  89.     sta $2133       ; screen setting (interlace x,y/enable SFX data)
  90.     sta $4200       ; enable v-blank, interrupt, joypad register
  91.     lda #$FF
  92.     sta $4201       ; programmable I/O port
  93.     lda #$00
  94.     sta $4202       ; multiplicand A
  95.     sta $4203       ; multiplier B
  96.     sta $4204       ; multiplier C
  97.     sta $4205       ; multiplicand C
  98.     sta $4206       ; divisor B
  99.     sta $4207       ; horizontal count timer
  100.     sta $4208       ; horizontal count timer MSB
  101.     sta $4209       ; vertical count timer
  102.     sta $420A       ; vertical count timer MSB
  103.     sta $420B       ; general DMA enable (bits 0-7)
  104.     sta $420C       ; horizontal DMA (HDMA) enable (bits 0-7)
  105.     sta $420D       ; access cycle designation (slow/fast rom)
  106.  
  107. ; set register modes
  108.     rep #$10        ; make X & Y 16-bits
  109.     sep #$20        ; make A 8-bits
  110.  
  111. ; initialise graphics hardware
  112.     lda #$03        ; graphics mode 3
  113.     sta $2105
  114.     lda #$01        ; enable plane 0
  115.     sta $212c
  116.     lda #$00        ; set plane 0 memory to $0000, 32x32 chars
  117.     sta $2107
  118.     lda #$01        ; set plane 0 character set to $1000
  119.     sta $210b
  120.  
  121. ; copy screen map data
  122.     ldx.w #$0000    ; set VRAM pointer to plane 0 memory location
  123.     stx $2116
  124.     ldx.w #$1801    ; dma to $2118
  125.     stx $4300
  126.     ldx.w #mapData&$FFFF ; source offset
  127.     stx $4302
  128.     lda #mapData/$10000 ; source bank
  129.     sta $4304
  130.     ldx.w #2048     ; number of bytes
  131.     stx $4305
  132.     lda #$01        ; do dma
  133.     sta $420B
  134.  
  135. ; set colour registers
  136.     lda #$00        ; select colour register 0
  137.     sta $2121
  138.     ldx.w #$2200    ; dma to $2122
  139.     stx $4300
  140.     ldx.w #colData&$FFFF ; source offset
  141.     stx $4302
  142.     lda #colData/$10000 ; source bank
  143.     sta $4304
  144.     ldx.w #512      ; number of bytes
  145.     stx $4305
  146.     lda #$01        ; do dma
  147.     sta $420B
  148.  
  149. ; set tile data
  150.     ldx.w #$1000    ; set VRAM pointer to character set location
  151.     stx $2116
  152.     ldx.w #$1801    ; dma to $2118
  153.     stx $4300
  154.     ldx.w #tileData&$FFFF ; source offset
  155.     stx $4302
  156.     lda #tileData/$10000 ; source bank
  157.     sta $4304
  158.     ldx.w #29952    ; number of bytes
  159.     stx $4305
  160.     lda #$01        ; do dma
  161.     sta $420B
  162.  
  163.     lda #$0F        ; enable screen, full brightness
  164.     sta $2100
  165.  
  166. ; loop forever while picture displayed
  167. forever
  168.     bra forever
  169.  
  170. ; screen map data
  171. mapData
  172.     incbin "mypic.map"
  173.  
  174. ; colour register data
  175. colData
  176.     incbin "mypic.col"
  177.  
  178. ; run/reset vector
  179.     pad $FFFC
  180.     dc.w start
  181.  
  182.     pad
  183.  
  184. ; tile set data
  185. tileData
  186.     incbin "mypic.set"
  187.  
  188.