home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fujiology Archive
/
fujiology_archive_v1_0.iso
/
!FALCON
/
LINEOUT
/
DELTA.ZIP
/
DELTASRC.ZIP
/
DELTA.SRC
/
BLURZOO2.SO
< prev
next >
Wrap
Text File
|
2003-01-02
|
28KB
|
1,592 lines
; Motherfuckin' blurzoomer-rotator thingy from south of heaven.
; Not to forget some morphin' bits as well. Kick it, chef.
; A screen for delta.
; Frametime is 40ms min, cos of 'run out of input for feedback' problem.
; A small accelerator (nemesis, ct1, phantom) helps alot!
;======= OBJECT EQUATES ========
XZoom.RX: = 42
XZoom.RY: = 26
RSRESET
BlurZoom.truecolor_tbl: RS.L 4096
BlurZoom.OBJ_START: RS.B 0
BlurZoom.circles_tbl: RS.W 100*3
BlurZoom.circles2_tbl: RS.W 100*3
BlurZoom.circles3_tbl: RS.W 100*3
BlurZoom.pyramid_tbl: RS.W 100*3
BlurZoom.delta_tbl: RS.W 100*3
BlurZoom.shape_tbl: RS.W 100*3
BlurZoom.destshape_tbl: RS.W 100*3
BlurZoom.OBJ_END: RS.B 0
BlurZoom.matrix_tbl: RS.W 3*3
BlurZoom.rotofadeoffset_tbl: RS.W 160*100
BlurZoom.sprite_buf: RS.W 16*16
BlurZoom.fadepal_tbl: RS.W 1<<16
BlurZoom.morph_tbl: RS.W 1+10*2
BlurZoom.BLOCK_SIZE: RS.B 0
;======= OBJECT TABLE ========
; Must be first in object!!
BlurZoom.table:
DC.L BlurZoom.mainLoop
DC.L BlurZoom.init
DC.L BlurZoom.deInit
DC.L TOGGLE_BOBS
DC.L SET_BLUR
DC.L SET_ROTO
DC.L SET_ROTOFADE
DC.L 0
;======= RESOLUTION SETTING ROUTINE ========
BlurZoom.initRealtime:
move.l #BlurZoom.setRes,vbl_gfx
bsr.l Mem.getBlock
move.l d0,BlurZoom.baseAdr
bsr BlurZoom.initMorphTable
; Clear obj tables!!!
move.w #(BlurZoom.OBJ_END-BlurZoom.OBJ_START)/2-1,d7
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.OBJ_START,a0
.clear_loop:
clr.w (a0)+
dbf d7,.clear_loop
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.circles_tbl,a0
bsr INIT_CIRCLES
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.circles2_tbl,a0
bsr INIT_CIRCLES2
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.circles3_tbl,a0
bsr INIT_CIRCLES3
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.pyramid_tbl,a0
bsr INIT_PYRAMID
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.delta_tbl,a0
bsr INIT_DELTA
movea.l BlurZoom.baseAdr,a0
movea.l a0,a1
adda.l #BlurZoom.truecolor_tbl,a0
lea flow_tbl,a1
bsr.l Pal.makeGradientTc
bsr CALC_FADEPAL
move.w #sintbllen/64,d0
move.w #27500,d1
bsr XZoom.calcVectors
addi.l #80<<8,d4
addi.l #50<<8,d5
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.rotofadeoffset_tbl,a0
bsr XZoom.calcOffsets
bsr SET_ROTO
clr.w enablebobs
move.l $4ba.w,morphstarttime
move.w monitormode,d0
cmpi.w #vga60,d0
beq.s .vga60
cmpi.w #vga100,d0
beq.s .vga100
cmpi.w #rgb50,d0
beq.s .rgb50
* Unknown monitormode..
rts
.vga60: move.l #PLOT_8BY8SPRITE160200,spriteRout
rts
.vga100:move.l #PLOT_8BY8SPRITE160100,spriteRout
rts
.rgb50: move.l #PLOT_8BY8SPRITE320100,spriteRout
rts
BlurZoom.setRes:
IFEQ testmode
move.l frmcnt,d0
sub.l lastframecount,d0
beq.s .end
move.l #rts,vbl_gfx
move.w monitormode,d0
cmpi.w #vga60,d0
beq.s .vga60
cmpi.w #vga100,d0
beq.s .vga100
cmpi.w #rgb50,d0
beq.s .rgb50
* Unknown monitormode..
.end: rts
.vga60: bra.l vga60_16bit_160_200
.vga100:bra.l vga100_16bit_160_100
.rgb50: bra.l rgb50_16bit_320_100
ENDC
;======= INIT SUBROUTINE ========
* OUTPUT: d0.l: 0 = All clear.
* neg = Error! Not initialized!
BlurZoom.init:
move.l #BlurZoom.BLOCK_SIZE,d0
bsr.l Mem.register
.success:
moveq #0,d0
rts
.error: moveq #-1,d0
rts
BlurZoom.deInit:
rts
;======= SCREENINIT SUBROUTINE ========
BlurZoom.initScreen:
rts
;======= MAINLOOP SUBROUTINE ========
BlurZoom.mainLoop:
move.w $0468.w,.old468
move.l frmcnt,d0
sub.l lastframecount,d0
bne.s .res_done
move.l d0,-(sp)
bsr BlurZoom.initRealtime
move.l (sp)+,d0
.res_done:
cmpi.l #3,d0
bhs.s .end_screeninit
bsr BlurZoom.initScreen
.end_screeninit:
lea scr,a2
movea.l (a2),a0
movea.l 8(a2),a1
movea.l BlurZoom.baseAdr,a2
adda.l #BlurZoom.rotofadeoffset_tbl,a2
movea.l backgroundadr,a3
jsr (a3)
.paint_bobs:
tst.w enablebobs
beq .end_paint_bobs
move.w colorpos,d0
addq.w #1,d0
andi.w #$1ff,d0
move.w d0,colorpos
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.truecolor_tbl,a0
lea (a0,d0.w*4),a0
moveq #0,d0
moveq #0,d1
moveq #0,d2
move.b (a0)+,d0
move.b (a0)+,d1
move.w (a0)+,d2
movea.l BlurZoom.baseAdr,a0
lea presprite_dat,a1
adda.l #BlurZoom.sprite_buf,a0
bsr CALC_8BY8SPRITE
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.morph_tbl,a0
move.w (a0)+,d1
move.w morphstep,d2
move.l $4ba.w,d0
sub.l morphstarttime,d0
cmpi.l #512,d0
blt.s .ok
moveq #0,d0
move.l $4ba.w,morphstarttime
addq.w #1,d2
cmp.w d1,d2
blt.s .ok
moveq #0,d2
.ok: move.w d2,morphstep
movem.l (a0,d2.w*4),a1-a2
lsl.w #6,d0
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.shape_tbl,a0
bsr MORPH_3DPOINTS
move.w $4bc.w,d0
move.w d0,d1
move.w d0,d2
lsl.w #1,d0
mulu.w #5,d1
lsr.w #2,d1
mulu.w #3,d2
lsr.w #2,d2
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.matrix_tbl,a0
bsr GENERATE_MATRIX
movea.l BlurZoom.baseAdr,a0
movea.l a0,a1
movea.l a0,a2
adda.l #BlurZoom.destshape_tbl,a0
adda.l #BlurZoom.matrix_tbl,a1
adda.l #BlurZoom.shape_tbl,a2
; adda.l #BlurZoom.delta_tbl,a2
move.w (a2)+,d7
bsr ROTATE_OBJECT
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.destshape_tbl,a0
bsr SORT_OBJECT
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.destshape_tbl,a0
move.w (a0)+,d7
subq.w #1,d7
bmi.s .end
.loop: move.w (a0)+,d0
move.w (a0)+,d1
asr.w #1,d0
asr.w #1,d1
addq #2,a0
add.w #80-4,d0
add.w #50-4,d1
move.w d7,-(sp)
move.l a0,-(sp)
movea.l scr,a0
movea.l BlurZoom.baseAdr,a1
adda.l #BlurZoom.sprite_buf,a1
movea.l spriteRout,a2
jsr (a2)
movea.l (sp)+,a0
move.w (sp)+,d7
dbf d7,.loop
.end:
.end_paint_bobs:
lea scr,a0
move.l (a0)+,d0
move.l (a0)+,d1
move.l (a0),-4(a0)
move.l d0,(a0)
move.l d1,-8(a0)
IFEQ testmode
move.l d0,d1
lsr.w #8,d0
move.l d0,$ffff8200.w
move.b d1,$ffff820d.w
move.w .old468(pc),d0
moveq #2,d2
cmpi.w #vga100,monitormode
bne.s .novga100
moveq #4,d2
.novga100:
.loop468:
move.w $0468.w,d1
sub.w d0,d1
cmp.w d2,d1
blt.s .loop468
ENDC
rts
.old468:
DC.W 0
;======= OBJECT SUBROUTINES ========
TOGGLE_BOBS:
not.w enablebobs
rts
SET_ROTO:
move.w monitormode,d0
cmpi.w #vga100,d0
beq.s .vga100
cmpi.w #vga60,d0
beq.s .vga60
cmpi.w #rgb50,d0
beq.s .rgb50
rts
.vga100:move.l #PLOT_ROTO_160100,backgroundadr
rts
.vga60: move.l #PLOT_ROTO_160200,backgroundadr
rts
.rgb50: move.l #PLOT_ROTO_320100,backgroundadr
rts
SET_ROTOFADE:
move.w monitormode,d0
cmpi.w #vga100,d0
beq.s .vga100
cmpi.w #vga60,d0
beq.s .vga60
cmpi.w #rgb50,d0
beq.s .rgb50
rts
.vga100:move.l #PLOT_ROTOF160100,backgroundadr
rts
.vga60: move.l #PLOT_ROTOF160200,backgroundadr
rts
.rgb50: move.l #PLOT_ROTOF320100,backgroundadr
rts
SET_BLUR:
move.w monitormode,d0
cmpi.w #vga100,d0
beq.s .vga100
cmpi.w #vga60,d0
beq.s .vga60
cmpi.w #rgb50,d0
beq.s .rgb50
rts
.vga100:move.l #BLUR_160100,backgroundadr
rts
.vga60: move.l #BLUR_160200,backgroundadr
rts
.rgb50: move.l #BLUR_320100,backgroundadr
rts
BlurZoom.initMorphTable:
movea.l BlurZoom.baseAdr,a0
movea.l a0,a1
adda.l #BlurZoom.morph_tbl,a0
move.w #4,(a0)+
movea.l a1,a2
adda.l #BlurZoom.circles_tbl,a2
movea.l a2,a6
move.l a2,(a0)+
movea.l a1,a2
adda.l #BlurZoom.circles2_tbl,a2
move.l a2,(a0)+
movea.l a1,a2
adda.l #BlurZoom.circles3_tbl,a2
move.l a2,(a0)+
movea.l a1,a2
adda.l #BlurZoom.pyramid_tbl,a2
move.l a2,(a0)+
move.l a6,(a0)+ ; Repeat 1st.
rts
* INPUT: d0.w: $0-$ff red
* d1.w: $0-$ff green
* d2.w: $0-$ff blue
* a0: highcolor rle sprite buffer to write to
* a1: bpp rle sprite data
CALC_8BY8SPRITE:
moveq #8-1,d7
.yloop: move.w (a1)+,d6
move.w d6,(a0)+
bmi.s .end_xloop
move.w (a1)+,(a0)+
.xloop: moveq #0,d3
move.w (a1)+,d3
move.l d3,d4
move.l d3,d5
mulu.w d0,d3
mulu.w d1,d4
mulu.w d2,d5
andi.w #%1111100000000000,d3
andi.w #%1111110000000000,d4
lsr.w #5,d4
lsr.w #8,d5
lsr.w #3,d5
or.w d3,d5
or.w d4,d5
move.w d5,(a0)+
dbra d6,.xloop
.end_xloop:
dbra d7,.yloop
rts
* INPUT: a0: shape
INIT_CIRCLES:
lea sine_tbl,a1
lea 2(a0),a6
moveq #0,d0
moveq #0,d4
moveq #9,d3
.loop1: Get_SinCos a1,d0,d1,d2
asr.w d3,d1
asr.w d3,d2
move.w d1,(a6)+
move.w d2,(a6)+
clr.w (a6)+
addq.w #1,d4
add.w #sintbllen/32,d0
cmp.w #sintbllen,d0
blt.s .loop1
moveq #0,d0
.loop2: Get_SinCos a1,d0,d1,d2
asr.w d3,d1
asr.w d3,d2
move.w d1,(a6)+
move.w d2,(a6)+
clr.w (a6)+
addq.w #1,d4
add.w #sintbllen/32,d0
cmp.w #sintbllen,d0
blt.s .loop2
move.w d4,(a0)
rts
* INPUT: a0: shape
INIT_CIRCLES2:
lea sine_tbl,a1
lea 2(a0),a6
moveq #0,d0
moveq #0,d4
moveq #9,d3
.loop1: Get_SinCos a1,d0,d1,d2
asr.w d3,d1
asr.w d3,d2
move.w d1,(a6)+
move.w d2,(a6)+
clr.w (a6)+
addq.w #1,d4
add.w #sintbllen/32,d0
cmp.w #sintbllen,d0
blt.s .loop1
moveq #0,d0
.loop2: Get_SinCos a1,d0,d1,d2
asr.w d3,d1
asr.w d3,d2
clr.w (a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
add.w #sintbllen/32,d0
cmp.w #sintbllen,d0
blt.s .loop2
move.w d4,(a0)
rts
* INPUT: a0: shape
INIT_CIRCLES3:
lea sine_tbl,a1
lea 2(a0),a6
moveq #0,d0
moveq #0,d4
moveq #9,d3
.loop1: Get_Sin a1,d0,d1
move.w d0,d2
add.w d2,d2
Do_SinModulo d2
Get_Sin a1,d2,d2
asr.w d3,d1
asr.w d3,d2
move.w d1,(a6)+
move.w d2,(a6)+
clr.w (a6)+
addq.w #1,d4
add.w #sintbllen/32,d0
cmp.w #sintbllen,d0
blt.s .loop1
moveq #0,d0
.loop2: Get_Sin a1,d0,d1
move.w d0,d2
add.w d2,d2
Do_SinModulo d2
Get_Sin a1,d2,d2
asr.w d3,d1
asr.w d3,d2
clr.w (a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
add.w #sintbllen/32,d0
cmp.w #sintbllen,d0
blt.s .loop2
move.w d4,(a0)
rts
* INPUT: a0: shape
INIT_PYRAMID:
lea 2(a0),a6
moveq #0,d4
move.w #-48,d0
move.w #-48,d1
move.w #-48,d2
.loop1: add.w #96/8,d0
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #48,d0
blt.s .loop1
.loop2: add.w #96/8,d1
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #48,d1
blt.s .loop2
.loop3: sub.w #96/8,d0
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #-48,d0
bgt.s .loop3
.loop4: sub.w #96/8,d1
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #-48,d1
bgt.s .loop4
moveq #0,d0
moveq #0,d1
moveq #48,d2
.loop5: move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
sub.w #96/8,d2
sub.w #48/8,d1
sub.w #48/8,d0
cmpi.w #-48,d2
bgt.s .loop5
moveq #48/8,d0
moveq #-48/8,d1
moveq #48-(96/8),d2
.loop6: move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
sub.w #96/8,d2
sub.w #48/8,d1
add.w #48/8,d0
cmpi.w #-48,d2
bgt.s .loop6
moveq #-48/8,d0
moveq #48/8,d1
moveq #48-(96/8),d2
.loop7: move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
sub.w #96/8,d2
add.w #48/8,d1
sub.w #48/8,d0
cmpi.w #-48,d2
bgt.s .loop7
moveq #48/8,d0
moveq #48/8,d1
moveq #48-(96/8),d2
.loop8: move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
sub.w #96/8,d2
add.w #48/8,d1
add.w #48/8,d0
cmpi.w #-48,d2
bgt.s .loop8
move.w d4,(a0)
rts
* INPUT: a0: shape
INIT_DELTA:
lea 2(a0),a6
moveq #0,d4
move.w #-48,d0
move.w #-48,d1
move.w #-16,d2
.loop:
.loop1: add.w #96/8,d0
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #48,d0
blt.s .loop1
.loop2: sub.w #48/8,d0
add.w #96/8,d1
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #0,d0
bgt.s .loop2
.loop3: sub.w #48/8,d0
sub.w #96/8,d1
move.w d0,(a6)+
move.w d1,(a6)+
move.w d2,(a6)+
addq.w #1,d4
cmpi.w #-48,d0
bgt.s .loop3
addi.w #16,d2
cmpi.w #16,d2
ble.s .loop
move.w d4,(a0)
rts
* INPUT: d0.w: X rotation (a)
* d1.w: Y rotation (b)
* d2.w: Z rotation (c)
* a0: matrix table to output to
GENERATE_MATRIX:
* 1> rotate 3 axis.
Do_SinModulo d0
Do_SinModulo d1
Do_SinModulo d2
movea.w d0,a3
movea.w d1,a4
movea.w d2,a5
lea sine_tbl,a2
* X := + x*cos(b)*cos(c)
* - y*cos(b)*sin(c)
* + z*sin(b)
Get_SinCos a2,d1,d3,d4
Get_SinCos a2,d2,d5,d6
muls.w d4,d6 * / cos(b)*sin(c)
add.l d6,d6 * |
swap d6 * \
muls.w d4,d5 * / -cos(b)*sin(c)
add.l d5,d5 * |
swap d5 * |
neg.w d5 * \
move.w d6,(a0)+
move.w d5,(a0)+
move.w d3,(a0)+
* Y := + x*(sin(a)*sin(b)*cos(c)+cos(a)*sin(c))
* + y*(cos(a)*cos(c)-sin(a)*sin(b)*sin(c))
* - z*sin(a)*cos(b)
Get_SinCos a2,a3,d0,d1
Get_Sin a2,a4,d2
Get_SinCos a2,a5,d4,d5
muls.w d0,d2
add.l d2,d2
swap d2
muls.w d2,d5
add.l d5,d5
swap d5
muls.w d1,d4
add.l d4,d4
swap d4
add.w d4,d5
bvc.s .skipyvd5
addq.w #1,d5
neg.w d5
.skipyvd5:
move.w d5,d3
;Get_SinCos a2,a3,d0,d1
Get_Sin a2,a4,d2
Get_SinCos a2,a5,d4,d5
muls.w d1,d5
add.l d5,d5
swap d5
muls.w d0,d2
add.l d2,d2
swap d2
muls.w d2,d4
add.l d4,d4
swap d4
sub.w d4,d5
bvc.s .skipyv2d5
addq.w #1,d5
neg.w d5
.skipyv2d5:
Get_Cos a2,a4,d4
muls.w d0,d4
add.l d4,d4
swap d4
neg.w d4
move.w d3,(a0)+
move.w d5,(a0)+
move.w d4,(a0)+
* Z := + x*(sin(a)*sin(c)-cos(a)*sin(b)*cos(c))
* + y*(cos(a)*sin(b)*sin(c)+sin(a)*cos(c))
* + z*cos(a)*cos(b)
Get_SinCos a2,a3,d0,d1
Get_Sin a2,a4,d2
Get_SinCos a2,a5,d4,d5
muls.w d0,d4
add.l d4,d4
bvc.s .skipzd4
subq.l #1,d4
.skipzd4:
swap d4
muls.w d1,d2
add.l d2,d2
bvc.s .skipzd2
subq.l #1,d2
.skipzd2:
swap d2
muls.w d2,d5
add.l d5,d5
swap d5
sub.w d5,d4
bvc.s .skipzvd4
addq.w #1,d4
neg.w d4
.skipzvd4:
move.w d4,d3
;Get_SinCos a2,a3,d0,d1
Get_Sin a2,a4,d2
Get_SinCos a2,a5,d4,d5
muls.w d1,d2
add.l d2,d2
bvc.s .skipz2d2
subq.l #1,d2
.skipz2d2:
swap d2
muls.w d2,d4
add.l d4,d4
swap d4
muls.w d0,d5
add.l d5,d5
bvc.s .skipzd5
subq.l #1,d5
.skipzd5:
swap d5
add.w d4,d5
bvc.s .skipzvd5
addq.w #1,d5
neg.w d5
.skipzvd5:
Get_Cos a2,a4,d4
muls.w d1,d4
add.l d4,d4
bvc.s .skipz2d4
subq.l #1,d4
.skipz2d4:
swap d4
move.w d3,(a0)+
move.w d5,(a0)+
move.w d4,(a0)+
rts
* INPUT: d7.w: number of points
* a0: detination vertices
* a1: rotation matrix
* a2: vertices
ROTATE_OBJECT:
move.w d7,(a0)+
subq.w #1,d7
bmi.s .end
.vertexloop:
movem.w (a2)+,d0-d2
REPT 3
move.w d0,d3
move.w d1,d4
move.w d2,d5
muls.w (a1)+,d3
muls.w (a1)+,d4
muls.w (a1)+,d5
add.l d3,d5
add.l d4,d5
add.l d5,d5
swap d5
move.w d5,(a0)+ * Store coordinate.
ENDR
lea -6*3(a1),a1
dbra d7,.vertexloop
.end: rts
; Calculates fade-palette. Just fast enough, altho it can be optimised!
CALC_FADEPAL:
movea.l BlurZoom.baseAdr,a0
adda.l #BlurZoom.fadepal_tbl,a0
clr.l d7
move.w #%1111100000000000,d3
move.w #%0000011111000000,d4
move.w #%0000000000011111,d5
.loop: move.l d7,d0
move.l d7,d1
and.w d3,d0
and.w d4,d1
movea.l d0,a1
movea.l d1,a2
lsl.l #8,d0
lsl.l #8,d1
sub.l a1,d0
sub.l a2,d1
lsr.l #8,d0
lsr.l #8,d1
and.w d3,d0
and.w d4,d1
or.w d1,d0
moveq #32-1,d6
.blueloop:
move.l d7,d2
and.w d5,d2
movea.l d2,a3
lsl.l #8,d2
sub.l a3,d2
lsr.l #8,d2
and.w d5,d2
or.w d0,d2
move.w d2,(a0)+
addq.w #1,d7
dbf d6,.blueloop
tst.w d7
bne.s .loop
rts
; Calculates rotationwindow vectors: a, b-a, c-a.
; We do this the convenient way. If we realize that:
; b-a = 2(r.x,0)'=2*r.x[+cos(t),+sin(t)]=2[+xc,+xs]
; c-a = 2(0,r.y)'=2*r.y[-sin(t),+cos(t)]=2[-ys,+yc]
;
; b-a
; a *----->* b
; |
; c-a | *--> (rx,0)' = r.x*[+cos(t),+sin(t)]
; | |
; v v
; c * (0,r.y)' = r.y*[-sin(t),+cos(t)]
;
; a.x = -cos(t)*r.x +sin(t)*r.y = -xc +ys
; a.y = -cos(t)*r.x -cos(t)*r.y = -xs -yc
;
; b.x = +xc +ys
; b.y = +xs -yc
;
; c.x = -xc -ys
; c.y = -xs +yc
;
; INPUT:
; d0.w = angle theta = t
; d1.w = scale [-32768,+32767] =^ [-2.0,+2.0]
; OUTPUT:
; d0.w = (b-a).x (8:8)
; d1.w = (b-a).y (8:8)
; d2.w = (c-a).x (8:8)
; d3.w = (c-a).y (8:8)
; d4.w = a.x (8:8)
; d5.w = a.y (8:8)
XZoom.calcVectors:
Do_SinModulo d0
Get_SinCos sine_tbl,d0,d0,d3
; d0.w=sin(t), d3.w=cos(t)
muls.w d1,d0
muls.w d1,d3
add.l d0,d0
add.l d3,d3
swap d0
swap d3
move.w d0,d2
move.w d3,d1
muls.w #+XZoom.RX,d0
muls.w #+XZoom.RX,d1
muls.w #+XZoom.RY,d2
muls.w #+XZoom.RY,d3
; d0.l=xs, d1.l=xc, d2.l=ys, d3.l=yc
; We calculate a.
move.l d1,d4
neg.l d4
add.l d2,d4
move.l d0,d5
neg.l d5
sub.l d3,d5
asr.l #6,d4
asr.l #6,d5
; We calculate b-a, c-a.
asr.l #5,d0
asr.l #5,d1
neg.l d2
asr.l #5,d2
asr.l #5,d3
exg.l d0,d1
rts
; Rotoreaming sewer-screwing.
; INPUT:
; d0.l = h.x (8:8)
; d1.l = h.y (8:8)
; d2.l = v.x (8:8)
; d3.l = v.y (8:8)
; d4.w = x (8:8)
; d5.w = y (8:8)
; a0: offsettable
XZoom.calcOffsets:
; We calculate stepvectors (slopes) from the window-vectors.
divs.w #160,d0
divs.w #160,d1
divs.w #100,d2
divs.w #100,d3
ext.l d0
ext.l d1
ext.l d2
ext.l d3
; d0.w = hx_step, d1.w = hy_step, d2.w = vx_step, d3.w = vy_step (8:8)
; Arrange the upperleft vector coordinates for speed.
lsl.l #8,d4
swap d5
move.w d4,d5
swap d5
swap d4
; d4.l = x..X, d5.l = x.Yy
move.l d5,d7
clr.w d6
move.b d4,d6
; d6.b = X, d7.l = x.Yy
; Arrange the vx_step, vy_step coordinates for speed.
lsl.l #8,d2
swap d3
move.w d2,d3
swap d3
swap d2
move.b d2,d5
movea.l d3,a3
; d5.b = X, a3 = x.Yy
; Arrange the hx_step, hy_step coordinates for speed.
lsl.l #8,d0
swap d1
move.w d0,d1
swap d1
swap d0
move.b d0,d2
movea.l d1,a4
; d2.b = X, a4 = x.Yy
move.l d7,d0
; d7.l = x.Yy
clr.l d4
moveq #100-1,d7
move.w monitormode,d0
cmpi.w #vga60,d0
beq.s Blurzoom.calc12Offsets
cmpi.w #vga100,d0
beq.s Blurzoom.calc11Offsets
cmpi.w #rgb50,d0
beq.s Blurzoom.calc11Offsets
; Unknown monitormode..
rts
Blurzoom.calc11Offsets:
.yloop: swap d7
move.w #160-1,d7
move.l d0,d1
move.w d6,d3
.xloop: move.w d1,d4
lsr.w #8,d4
mulu.w #160,d4
add.w d3,d4
move.w d4,(a0)+
add.l a4,d1
addx.b d2,d3
dbf d7,.xloop
add.l a3,d0 ; Yy:=Yy+Yy_vstep, x:=x+x_vstep
addx.b d5,d6 ; X:=X+X_vstep
swap d7
dbf d7,.yloop
rts
Blurzoom.calc12Offsets:
.yloop: swap d7
move.w #160-1,d7
move.l d0,d1
move.w d6,d3
.xloop: move.w d1,d4
lsr.w #8,d4
mulu.w #160*2,d4
add.w d3,d4
move.w d4,(a0)+
add.l a4,d1
addx.b d2,d3
dbf d7,.xloop
add.l a3,d0 ; Yy:=Yy+Yy_vstep, x:=x+x_vstep
addx.b d5,d6 ; X:=X+X_vstep
swap d7
dbf d7,.yloop
rts
* Perform a linear morph between 3d vertices.
* INPUT: d0.w: 0..32767 morph index
* a0: destination vertices
* a1: begin vertices
* a2: end vertices
MORPH_3DPOINTS:
move.w #32767,d3
sub.w d0,d3
addq #2,a2
move.w (a1)+,d7
move.w d7,(a0)+
subq.w #1,d7
bmi.s .end
.loop:
REPT 3
move.w (a1)+,d1
move.w (a2)+,d2
muls.w d3,d1
muls.w d0,d2
add.l d1,d2
add.l d2,d2
swap d2
move.w d2,(a0)+
ENDR
dbra d7,.loop
.end: rts
* INPUT: a0: 3d object
SORT_OBJECT:
move.w (a0)+,d7 * d7.w: number of elements
movea.l a0,a6
move.w d7,d4
subq.w #1,d7
ble.s .endcombsort
lsr.w #1,d4 * d4.w: gapsize
movea.w #6,a5
bra.s .endcalcgap
.combsortloop:
cmpi.w #2,d4 * / If the gapsize
bhi.s .calcgap * | is already 1 or
moveq #1,d4 * | 2 then always
bra.s .endcalcgap * \ set it to 1.
.calcgap:
mulu.w #((1<<16)*10)/13,d4 * / Resize
swap d4 * \ the gap.
.endcalcgap:
move.w d7,d6
sub.w d4,d6
move.w d4,d0
mulu.w #6,d0
lea (a0,d0.l),a1
moveq #0,d5 * d5.w: number of swaps done in loop
.combsortinloop:
move.w 4(a0),d0
move.w 4(a1),d1
cmp.w d1,d0
ble.s .noswap
move.l (a0),d2
move.l (a1),(a0)+
move.l d2,(a1)+
move.w d0,(a1)+
move.w d1,(a0)+
addq.w #1,d5
dbra d6,.combsortinloop
bra.s .combsortloopend
.noswap:
adda.l a5,a0
adda.l a5,a1
dbra d6,.combsortinloop
.combsortloopend:
movea.l a6,a0
move.w d5,d5
bne.s .combsortloop
cmpi.w #1,d4
bne.s .combsortloop
.endcombsort:
.rts: rts
; INPUT:
; a0: dst screen
; a1: src screen
; a2: offsetmap
PLOT_ROTO_320100:
move.w #(160*100)/32-1,d7
.loop: REPT 4
movem.w (a2)+,d0-d6/a3
move.l 0(a1,d0.l*4),(a0)+
move.l 0(a1,d1.l*4),(a0)+
move.l 0(a1,d2.l*4),(a0)+
move.l 0(a1,d3.l*4),(a0)+
move.l 0(a1,d4.l*4),(a0)+
move.l 0(a1,d5.l*4),(a0)+
move.l 0(a1,d6.l*4),(a0)+
move.l 0(a1,a3.l*4),(a0)+
ENDR
dbf d7,.loop
rts
; INPUT:
; a0: dst screen
; a1: src screen
; a2: offsetmap
PLOT_ROTO_160100:
move.w #160*100/32-1,d7
.loop: REPT 4
movem.w (a2)+,d0-d6/a3
move.w 0(a1,d0.l*2),(a0)+
move.w 0(a1,d1.l*2),(a0)+
move.w 0(a1,d2.l*2),(a0)+
move.w 0(a1,d3.l*2),(a0)+
move.w 0(a1,d4.l*2),(a0)+
move.w 0(a1,d5.l*2),(a0)+
move.w 0(a1,d6.l*2),(a0)+
move.w 0(a1,a3.l*2),(a0)+
ENDR
dbf d7,.loop
rts
; INPUT:
; a0: dst screen
; a1: src screen
; a2: offsetmap
PLOT_ROTO_160200:
moveq #100-1,d7
lea 160*2(a0),a4
.yloop: swap d7
move.w #160/8-1,d7
.xloop: movem.w (a2)+,d0-d6/a3
move.w 0(a1,d0.l*2),(a0)+
move.w 0(a1,d1.l*2),(a0)+
move.w 0(a1,d2.l*2),(a0)+
move.w 0(a1,d3.l*2),(a0)+
move.w 0(a1,d4.l*2),(a0)+
move.w 0(a1,d5.l*2),(a0)+
move.w 0(a1,d6.l*2),(a0)+
move.w 0(a1,a3.l*2),(a0)+
move.w 0(a1,d0.l*2),(a4)+
move.w 0(a1,d1.l*2),(a4)+
move.w 0(a1,d2.l*2),(a4)+
move.w 0(a1,d3.l*2),(a4)+
move.w 0(a1,d4.l*2),(a4)+
move.w 0(a1,d5.l*2),(a4)+
move.w 0(a1,d6.l*2),(a4)+
move.w 0(a1,a3.l*2),(a4)+
dbf d7,.xloop
adda.w #160*2,a0
adda.w #160*2,a4
swap d7
dbf d7,.yloop
rts
; INPUT:
; a0: dst screen
; a1: src screen
; a2: offsetmap
PLOT_ROTOF320100:
move.l BlurZoom.baseAdr,a3
adda.l #BlurZoom.fadepal_tbl,a3
moveq #0,d0
move.w #160*100/8-1,d7
.loop: REPT 8
move.w (a2)+,d0
move.w (a1,d0.l*4),d0
move.w (a3,d0.l*2),d0
move.w d0,(a0)+
move.w d0,(a0)+
ENDR
dbra d7,.loop
rts
; INPUT:
; a0: dst screen
; a1: src screen
; a2: offsetmap
PLOT_ROTOF160100:
movea.l BlurZoom.baseAdr,a3
adda.l #BlurZoom.fadepal_tbl,a3
moveq #0,d0
move.w #160*100/8-1,d7
.loop: REPT 8
move.w (a2)+,d0
move.w (a1,d0.l*2),d0
move.w (a3,d0.l*2),d0
move.w d0,(a0)+
ENDR
dbra d7,.loop
rts
; INPUT:
; a0: dst screen
; a1: src screen
; a2: offsetmap
PLOT_ROTOF160200:
movea.l BlurZoom.baseAdr,a3
adda.l #BlurZoom.fadepal_tbl,a3
moveq #0,d0
moveq #100-1,d7
.yloop: moveq #160/8-1,d6
lea 160*2(a0),a4
.xloop: REPT 8
move.w (a2)+,d0
move.w (a1,d0.l*2),d0
move.w (a3,d0.l*2),d0
move.w d0,(a0)+
move.w d0,(a4)+
ENDR
dbf d6,.xloop
adda.w #160*2,a0
dbf d7,.yloop
rts
; INPUT:
; a0: dst screen
; a1: src screen
BLUR_320100:
move.w #%0111101111101111,d1
move.w #160*100-1,d7
.loop: move.w (a1),d0
addq #4,a1
lsr.w #1,d0
and.w d1,d0
move.w d0,(a0)+
move.w d0,(a0)+
dbra d7,.loop
rts
; INPUT:
; a0: dst screen
; a1: src screen
BLUR_160100:
move.w #%0111101111101111,d1
move.w #160*100-1,d7
.loop: move.w (a1)+,d0
lsr.w #1,d0
and.w d1,d0
move.w d0,(a0)+
dbra d7,.loop
rts
; INPUT:
; a0: dst screen
; a1: src screen
BLUR_160200:
move.w #%0111101111101111,d1
moveq #100-1,d7
lea 160*2(a0),a2
.yloop: moveq #160/8-1,d6
.xloop: REPT 8
move.w (a1)+,d0
lsr.w #1,d0
and.w d1,d0
move.w d0,(a0)+
move.w d0,(a2)+
ENDR
dbf d6,.xloop
adda.w #160*2,a0
adda.w #160*2,a1
adda.w #160*2,a2
dbf d7,.yloop
rts
* INPUT: d0.w: topleft x
* d1.w: topleft y
* d2.w: topright dx
* d3.w: topright dy
* d4.w: bottomleft dx
* d5.w: bottomleft dy
* a0: screen
* a1: texture
PLOT_ROTOLAYER:
.xloop: move.w d0,d4
move.b d1,d4
move.w (a1,d4.l*2),(a0)+
add.l d2,d0
addx.b d3,d1
dbra d6,.xloop
rts
* B-ware! No clipping!
* INPUT: d0.w: topleft x
* d1.w: topleft y
* a0: screen
* a1: sprite
PLOT_8BY8SPRITE320100:
lea (a0,d0.w*4),a0
move.w #160*4,d5
mulu.w d5,d1
adda.l d1,a0
movea.l a0,a6
movea.w d5,a5
moveq #8-1,d7
move.w #%0111101111101111,d2
.yloop: move.w (a1)+,d6
bmi.s .end_xloop
move.w (a1)+,d0
lea (a0,d0.w*4),a0
.xloop:
IFNE 1
move.w (a1)+,d0
lsr.w #1,d0
and.w d2,d0
move.w (a0),d1
lsr.w #1,d1
and.w d2,d1
add.w d0,d1
move.w d1,(a0)+
move.w d1,(a0)+
ELSE
move.w (a1),(a0)+
move.w (a1)+,(a0)+
ENDC
.skip_pixel:
dbra d6,.xloop
.end_xloop:
adda.l a5,a6
movea.l a6,a0
dbra d7,.yloop
rts
* B-ware! No clipping!
* INPUT: d0.w: topleft x
* d1.w: topleft y
* a0: screen
* a1: sprite
PLOT_8BY8SPRITE160100:
lea (a0,d0.w*2),a0
move.w #160*2,d5
mulu.w d5,d1
adda.l d1,a0
movea.l a0,a6
movea.w d5,a5
moveq #8-1,d7
move.w #%0111101111101111,d2
.yloop: move.w (a1)+,d6
bmi.s .end_xloop
move.w (a1)+,d0
lea (a0,d0.w*2),a0
.xloop:
IFNE 1
move.w (a1)+,d0
lsr.w #1,d0
and.w d2,d0
move.w (a0),d1
lsr.w #1,d1
and.w d2,d1
add.w d0,d1
move.w d1,(a0)+
ELSE
move.w (a1)+,(a0)+
ENDC
.skip_pixel:
dbra d6,.xloop
.end_xloop:
adda.l a5,a6
movea.l a6,a0
dbra d7,.yloop
rts
* B-ware! No clipping!
* INPUT: d0.w: topleft x
* d1.w: topleft y
* a0: screen
* a1: sprite
PLOT_8BY8SPRITE160200:
lea (a0,d0.w*2),a0
move.w #160*2*2,d5
mulu.w d5,d1
adda.l d1,a0
movea.l a0,a6
movea.w d5,a5
moveq #8-1,d7
move.w #%0111101111101111,d2
.yloop: move.w (a1)+,d6
bmi.s .end_xloop
move.w (a1)+,d0
lea (a0,d0.w*2),a0 ; even line
lea 160*2(a0),a2 ; odd line
.xloop:
IFNE 1
move.w (a1)+,d0
lsr.w #1,d0
and.w d2,d0
move.w (a0),d1
lsr.w #1,d1
and.w d2,d1
add.w d0,d1
move.w d1,(a0)+
move.w d1,(a2)+
ELSE
move.w (a1),(a0)+
move.w (a1)+,(a2)+
ENDC
.skip_pixel:
dbf d6,.xloop
.end_xloop:
adda.l a5,a6
movea.l a6,a0
dbf d7,.yloop
rts
;======= OBJECT DATA ========
DATA
enablebobs:
DC.W 0
backgroundadr:
DC.L PLOT_ROTO_160100
presprite_dat
DC.W 2-1,3,$20,$20
DC.W 4-1,2,$20,$40,$40,$20
DC.W 6-1,1,$20,$40,$80,$80,$20,$20
DC.W 8-1,0,$20,$40,$80,$ff,$ff,$80,$40,$20
DC.W 8-1,0,$20,$40,$80,$ff,$ff,$80,$40,$20
DC.W 6-1,1,$20,$40,$80,$80,$40,$20
DC.W 4-1,2,$20,$40,$40,$20
DC.W 2-1,3,$20,$20
sprite_dat:
DC.W 2-1,3,$18e3,$18e3
DC.W 4-1,2,$18e3,$39e7,$39e7,$18e3
DC.W 6-1,1,$18e3,$39e7,$7bef,$7bef,$39e7,$18e3
DC.W 8-1,0,$18e3,$39e7,$7bef,$ffff,$ffff,$7bef,$39e7,$18e3
DC.W 8-1,0,$18e3,$39e7,$7bef,$ffff,$ffff,$7bef,$39e7,$18e3
DC.W 6-1,1,$18e3,$39e7,$7bef,$7bef,$39e7,$18e3
DC.W 4-1,2,$18e3,$39e7,$39e7,$18e3
DC.W 2-1,3,$18e3,$18e3
flow_tbl:
DC.W 32 (.end-.start)/4
DC.W 4
.start: DC.L $ff000000 ;DC.L $00000000
DC.L $ff00001f ;DC.L $003f0000
DC.L $ff00003f ;DC.L $007f0000
DC.L $ff00005f ;DC.L $3fdf0000
DC.L $ff00007f ;DC.L $7fff0000
DC.L $ff00009f ;DC.L $dfff0000
DC.L $ff0000bf ;DC.L $ffff0000
DC.L $ff0000df ;DC.L $ffff003f
DC.L $ff0000ff ;DC.L $ffff007f
DC.L $df1f00ff ;DC.L $ffff00bf
DC.L $bf3f00ff ;DC.L $ffff00ff
DC.L $9f5f00ff ;DC.L $ffff00ff
DC.L $7f7f00ff ;DC.L $ffff00ff
DC.L $5f9f00ff ;DC.L $ffff00ff
DC.L $3fbf00ff ;DC.L $ffff00ff
DC.L $1fdf00ff ;DC.L $ffff00ff
DC.L $00ff00ff ;DC.L $ffff00ff
DC.L $1fff00ff
DC.L $3fff00ff
DC.L $5fff00ff
DC.L $7fff00ff
DC.L $9fff00ff
DC.L $bfff00ff
DC.L $dfff00ff
DC.L $ffff00ff
DC.L $ffdf00df
DC.L $ffbf00bf
DC.L $ff9f009f
DC.L $ff7f007f
DC.L $ff5f005f
DC.L $ff3f003f
DC.L $ff1f001f
DC.L $ff000000
.end:
spriteRout:
DC.L PLOT_8BY8SPRITE160100
;======= OBJECT RESERVES ========
BSS
colorpos:
DS.W 1
morphstarttime:
DS.L 1
morphstep:
DS.W 1
BlurZoom.baseAdr:
DS.L 1
;======= END OF DEMO-EFFECT OBJECT ========