Welcome, Guest. Please login or register.

Author Topic: I made my first demoscene effect in assembler!  (Read 6948 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DamageX

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show all replies
    • http://www.hyakushiki.net/
Re: I made my first demoscene effect in assembler!
« on: November 26, 2006, 07:29:07 AM »
Instead of calculating the coordinates of the source pixel in the texture every time you write a pixel to the copper list, I think it is faster to maintain a set of coordinates and modify them with predetermined values.

so your inner loop could look something like:

NextY:
move #30,d2 ; width of screen
NextX:
add.w d4,d0 ; modify source x coordinate (for every change
add.w d5,d1 ; modify source y coordinate  in x direction)
move.w #$07C0,d3 ; mask for y coordinate (32x32 texture?)
and.w d1,d3
lea Texture,a1 ; pointer to texture
add.w d3,a1
move.w #$07C0,d3 ; mask for x coordinate
and.w d0,d3
lsr.w #5,d3
add.w d3,a1 ; now we have the correct address
move.w (a1),(a0)+ ; copy a pixel from texture to screen
subq.b #1,d2
bne NextX
add.w d6,d0 ; modify source x coordinate (for every change
add.w d7,d1 ; modify source y coordinate  in y direction)
; probably something needs to be added to copperlist
; pointer in a0 so it points to next line
subq.b #1,LineY
bne NextY

hope that makes some sense and hasn't too many bugs...

for calculating the magic numbers in d4,d5,d6,d7
d4 = x_scale * cos(angle)
d5 = x_scale * -sin(angle)
d6 = y_scale * sin(angle)
d7 = y_scale * cos(angle)
(in my example code I use fixed-point math with 6 bits of fraction so multiply by 64)
 

Offline DamageX

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show all replies
    • http://www.hyakushiki.net/
Re: I made my first demoscene effect in assembler!
« Reply #1 on: December 03, 2006, 05:10:01 AM »
I've read two things about getting the 4x1 AGA copper chunky mode, I'm not sure what is right. 1) turn off all bitplanes 2) set the low bits in FMODE (register 1FC) and use a 32-bit aligned copper list

Other than that I guess it is the same as your current program.
 

Offline DamageX

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show all replies
    • http://www.hyakushiki.net/
Re: I made my first demoscene effect in assembler!
« Reply #2 on: December 13, 2006, 06:14:20 AM »
So what you're saying is there isn't really a way to make the copper run faster with AGA?

I guess I understand now. You use the copper to write colors into the palette registers instead of the background color register. Use 7 bitplanes (setup with fixed values counting 0,0,0,1,1,1,2,2,2,etc.) so that the copper can be writing to one half of the palette (128 colors) while the other half is being displayed. But to give the copper enough time to write that many colors to the palette, it must work during two or more scanlines, so the vertical resolution is limitted...