home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fujiology Archive
/
fujiology_archive_v1_0.iso
/
!FALCON
/
LINEOUT
/
DELTA.ZIP
/
DELTASRC.ZIP
/
DELTA.SRC
/
PLASMA.SO
< prev
next >
Wrap
Text File
|
2002-09-11
|
10KB
|
607 lines
; Textured sine plasma. A screen for delta.
;======= OBJECT EQUATES ========
RSRESET
Plasma.TEXTURE: RS.W 256*256
Plasma.BLOCK_SIZE: RS.B 0
;======= OBJECT TABLE ========
* Must be first in object!!
Plasma.table:
DC.L PlasmaMAINLOOP
DC.L Plasma.init
DC.L Plasma.setRes
DC.L Plasma.togglePalletteCycle
DC.L Plasma.setPalletteMode
DC.L Plasma.setBumpmapMode
* Add more addresses here..
DC.L 0
;======= RESOLUTION SETTING ROUTINE ========
Plasma.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..
rts
.vga60: bra.l vga60_16bit_160_200
.vga100:bra.l vga100_16bit_160_100
.rgb50: bra.l rgb50_16bit_320_100
ENDC
.end: rts
;======= INIT SUBROUTINE ========
; OUTPUT: d0.l: 0 = All clear.
; neg = Error! Not initialized!
Plasma.init:
move.l #Plasma.BLOCK_SIZE,d0
bsr.l Mem.register
lea Plasma.flowTable,a1
lea Plasma.pallette,a0
bsr.l Pal.makeGradientHc
bsr Plasma.initSinewaves
.success:
moveq #0,d0
rts
.error: moveq #-1,d0
rts
Plasma.realtimeInit:
move.l #Plasma.setRes,vbl_gfx
bsr.l Mem.getBlock
move.l d0,Plasma.baseAdr
movea.l Plasma.baseAdr,a0
adda.l #Plasma.TEXTURE,a0
lea Texture.8bTexture1,a1
lea Texture.crapPal,a2
clr.w d7
clr.l d0
.conv_loop:
move.b (a1)+,d0
move.w (a2,d0.l*2),(a0)+
addq.w #1,d7
bne.s .conv_loop
rts
;======= SCREENINIT SUBROUTINE ========
Plasma.initScreen:
; Insert screenarea initialising, etc. in here!
rts
;======= MAINLOOP SUBROUTINE ========
PlasmaMAINLOOP:
move.w $0468.w,.old468
move.l frmcnt,d0
sub.l lastframecount,d0
bne.s .end_realtime_init
move.l d0,-(sp)
bsr Plasma.realtimeInit
move.l (sp)+,d0
.end_realtime_init:
cmpi.l #3,d0
bhs.s .end_screeninit
bsr Plasma.initScreen
.end_screeninit:
movea.l Plasma.routineAddress,a0
jsr (a0)
IFEQ testmode
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)
move.l d0,d1
lsr.w #8,d0
move.l d0,$ffff8200.w
move.b d1,$ffff820d.w
move.w .old468(pc),d0
.wait: cmp.w $0468.w,d0
beq.s .wait
ENDC
rts
.old468:DC.W 0
;======= OBJECT SUBROUTINES ========
Plasma.togglePalletteCycle:
not.w Plasma.cycling
rts
Plasma.setPalletteMode:
move.l #Plasma.paint,Plasma.routineAddress
rts
Plasma.setBumpmapMode:
move.l #Plasma.paintBumped,Plasma.routineAddress
rts
Plasma.initSinewaves:
* Initialize first cosine table. This one has a short period.
lea sine_tbl+2,a1
lea Plasma.cosTable1,a0
move.w #256-1,d7
.loop1: move.w (a1),d0
addi.w #$8000,d0
lsr.w #8,d0
add.w d0,d0
move.w d0,(a0)+
lea 8*4(a1),a1
dbra d7,.loop1
lea Plasma.cosTable1,a1
move.w #256-1,d7
.loop1a:move.w (a1)+,(a0)+
dbra d7,.loop1a
lea Plasma.cosTable1,a1
move.w #256-1,d7
.loop1b:move.w (a1)+,(a0)+
dbra d7,.loop1b
* Initialize first cosine table. This one has a short period.
lea sine_tbl+2,a1
lea Plasma.cosTable2,a0
move.w #128-1,d7
.loop2: move.w (a1),d0
addi.w #$8000,d0
lsr.w #8,d0
add.w d0,d0
move.w d0,(a0)+
lea 16*4(a1),a1
dbra d7,.loop2
lea Plasma.cosTable2,a1
move.w #128-1,d7
.loop2a:move.w (a1)+,(a0)+
dbra d7,.loop2a
lea Plasma.cosTable2,a1
move.w #128-1,d7
.loop2b:move.w (a1)+,(a0)+
dbra d7,.loop2b
lea Plasma.cosTable1,a1
lea Plasma.cosTable1a,a0
move.w #256*3-1,d7
.scaleloop1:
move.w (a1)+,d0
lsr.w #2,d0
andi.w #$fe,d0
move.w d0,(a0)+
dbra d7,.scaleloop1
lea Plasma.cosTable2,a1
lea Plasma.cosTable2a,a0
move.w #128*3-1,d7
.scaleloop2:
move.w (a1)+,d0
lsr.w #2,d0
andi.w #$fe,d0
move.w d0,(a0)+
dbra d7,.scaleloop2
rts
* Paints a pallette based sinoid plasma on screen.
Plasma.paint:
movea.l scr,a0
.handle_cycling:
move.w Plasma.cyclePhase,d0
tst.w Plasma.cycling
beq.s .end_handle_cycling
addq.w #8,d0
andi.w #1024-1,d0
move.w d0,Plasma.cyclePhase
.end_handle_cycling:
lea (Plasma.pallette,d0.w*2),a1
lea Plasma.cosTable1,a2
lea Plasma.cosTable2,a6
moveq #100-1,d7
move.w $4bc.w,d0
move.w d0,d3
mulu.w #11,d3
lsr.l #4,d3
andi.w #$00ff,d3
move.w (a2,d3.w*2),d3
lsr.w #2,d3
andi.w #$00ff,d3
move.w d0,d4
mulu.w #5,d4
lsr.l #3,d4
andi.w #$00ff,d4
move.w (a2,d4.w*2),d4
lsr.w #1,d4
move.w d0,d5
mulu.w #7,d5
lsr.l #4,d5
andi.w #$00ff,d5
move.w (a2,d5.w*2),d5
lsr.w #1,d5
moveq #0,d2
move.w monitormode,d0
cmpi.w #vga60,d0
beq Plasma.paintVga60
cmpi.w #vga100,d0
beq Plasma.paintVga100
cmpi.w #rgb50,d0
beq Plasma.paintRgb50
* Unknown monitormode..
rts
Plasma.paintVga60:
lea 160*2(a0),a5
.yloop: swap d7
move.w #160/8-1,d7
move.w (a2,d3.l*2),d2
move.l a1,d6
lea (a1,d2.l),a1
* Calculate cosine 1 offset.
move.b d4,d0
andi.w #$FE,d0
lea (a6,d0.w),a4
* Calculate cosine 2 offset
move.w (a2,d5.l*2),d1
lea (a2,d1.w),a3
.xloop: REPT 8
move.w (a4)+,d2
add.w (a3)+,d2
move.w (a1,d2.l),(a0)+
move.w (a1,d2.l),(a5)+
ENDR
dbra d7,.xloop
movea.l d6,a1
lea 160*2(a0),a0
lea 160*2(a5),a5
addq.b #1,d3
addq.b #2,d4
addq.b #2,d5
swap d7
dbra d7,.yloop
.end: rts
Plasma.paintVga100:
.yloop: swap d7
move.w #160/8-1,d7
move.w (a2,d3.l*2),d2
lea (a1,d2.l),a5
* Calculate cosine 1 offset.
move.b d4,d0
andi.w #$FE,d0
lea (a6,d0.w),a4
* Calculate cosine 2 offset
move.w (a2,d5.l*2),d1
lea (a2,d1.w),a3
.xloop:
REPT 8
move.w (a4)+,d2
add.w (a3)+,d2
move.w (a5,d2.l),(a0)+
ENDR
dbra d7,.xloop
addq.b #1,d3
addq.b #2,d4
addq.b #2,d5
swap d7
dbra d7,.yloop
.end: rts
Plasma.paintRgb50:
.yloop: swap d7
move.w #160/8-1,d7
move.w (a2,d3.l*2),d2
lea (a1,d2.l),a5
* Calculate cosine 1 offset.
move.b d4,d0
andi.w #$FE,d0
lea (a6,d0.w),a4
* Calculate cosine 2 offset
move.w (a2,d5.l*2),d1
lea (a2,d1.w),a3
.xloop:
REPT 8
move.w (a4)+,d2
add.w (a3)+,d2
move.l (a5,d2.l),(a0)+
ENDR
dbra d7,.xloop
addq.b #1,d3
addq.b #2,d4
addq.b #2,d5
swap d7
dbra d7,.yloop
.end: rts
* Paints a bumpmapped sinoid plasma on screen.
Plasma.paintBumped:
movea.l scr,a0
.calc_position:
lea sine_tbl,a1
move.w $4bc.w,d0
move.w d0,d1
add.w d0,d0
mulu.w #3,d1
lsr.l #1,d1
Do_SinModulo d0
Do_SinModulo d1
Get_Sin a1,d0,d0
Get_Sin a1,d1,d1
addi.w #$8000,d0
addi.w #$8000,d1
andi.w #$ff00,d0
lsr.w #1,d0
lsr.w #8,d1
lsr.w #1,d1
move.b d1,d0
.end_calc_position:
movea.l Plasma.baseAdr,a1
adda.l #Plasma.TEXTURE,a1
lea (a1,d0.w*2),a1
lea Plasma.cosTable1,a2
lea Plasma.cosTable2,a6
moveq #100-1,d7
move.w $4bc.w,d0
move.w d0,d3
mulu.w #11,d3
lsr.l #4,d3
andi.w #$00ff,d3
move.w (a2,d3.w*2),d3
lsr.w #2,d3
andi.w #$00ff,d3
move.w d0,d4
mulu.w #5,d4
lsr.l #3,d4
andi.w #$00ff,d4
move.w (a2,d4.w*2),d4
lsr.w #1,d4
move.w d0,d5
mulu.w #7,d5
lsr.l #4,d5
andi.w #$00ff,d5
move.w (a2,d5.w*2),d5
lsr.w #1,d5
moveq #0,d2
lea Plasma.cosTable1a,a2
lea Plasma.cosTable2a,a6
move.w monitormode,d0
cmpi.w #vga60,d0
beq Plasma.paintBumpedVga60
cmpi.w #vga100,d0
beq Plasma.paintBumpedVga100
cmpi.w #rgb50,d0
beq Plasma.paintBumpedRgb50
* Unknown monitormode..
rts
Plasma.paintBumpedVga100:
.yloop: swap d7
move.w #160/8-1,d7
move.w (a2,d3.l*2),d2
lea (a1,d2.l),a5
* Calculate cosine 1 offset.
move.w d4,d0
andi.w #$fe,d0
lea (a6,d0.w),a4
* Calculate cosine 2 offset
move.w (a2,d5.l*2),d1
lea (a2,d1.w),a3
.xloop: REPT 8
move.w (a4)+,d2
add.w (a3)+,d2
move.w (a5,d2.l),(a0)+
addq #2,a5
ENDR
dbra d7,.xloop
lea 256*2(a1),a1
addq.b #2,d3
addq.b #1,d4
addq.b #3,d5
swap d7
dbra d7,.yloop
.end: rts
Plasma.paintBumpedVga60:
lea 160*2(a0),a5
.yloop: swap d7
move.w #160/8-1,d7
move.w (a2,d3.l*2),d2
move.l a1,d6
lea (a1,d2.l),a1
* Calculate cosine 1 offset.
move.w d4,d0
andi.w #$fe,d0
lea (a6,d0.w),a4
* Calculate cosine 2 offset
move.w (a2,d5.l*2),d1
lea (a2,d1.w),a3
.xloop: REPT 8
move.w (a4)+,d2
add.w (a3)+,d2
move.w (a1,d2.l),(a0)+
move.w (a1,d2.l),(a5)+
addq #2,a1
ENDR
dbra d7,.xloop
movea.l d6,a1
lea 256*2(a1),a1
lea 160*2(a0),a0
lea 160*2(a5),a5
addq.b #2,d3
addq.b #1,d4
addq.b #3,d5
swap d7
dbra d7,.yloop
.end: rts
Plasma.paintBumpedRgb50:
.yloop: swap d7
move.w #160/8-1,d7
move.w (a2,d3.l*2),d2
lea (a1,d2.l),a5
* Calculate cosine 1 offset.
move.w d4,d0
andi.w #$fe,d0
lea (a6,d0.w),a4
* Calculate cosine 2 offset
move.w (a2,d5.l*2),d1
lea (a2,d1.w),a3
.xloop: REPT 8
move.w (a4)+,d2
add.w (a3)+,d2
move.l (a5,d2.l),(a0)+
addq #2,a5
ENDR
dbra d7,.xloop
lea 256*2(a1),a1
addq.b #2,d3
addq.b #1,d4
addq.b #3,d5
swap d7
dbra d7,.yloop
.end: rts
;======= OBJECT DATA ========
DATA
Plasma.routineAddress:
DC.L Plasma.paintBumped
Plasma.flowTable:
DC.W 32 (.end-.start)/4
DC.W 5
.start: DC.L $ff000000 ;DC.L $00000000
DC.L $bf00001f ;DC.L $003f0000
DC.L $7f00003f ;DC.L $007f0000
DC.L $3f00005f ;DC.L $3fdf0000
DC.L $0000007f ;DC.L $7fff0000
DC.L $0000009f ;DC.L $dfff0000
DC.L $000000bf ;DC.L $ffff0000
DC.L $000000df ;DC.L $ffff003f
DC.L $000000ff ;DC.L $ffff007f
DC.L $001f00ff ;DC.L $ffff00bf
DC.L $003f00ff ;DC.L $ffff00ff
DC.L $005f00ff ;DC.L $ffff00ff
DC.L $007f00ff ;DC.L $ffff00ff
DC.L $009f00ff ;DC.L $ffff00ff
DC.L $00bf00ff ;DC.L $ffff00ff
DC.L $00df00ff ;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:
;======= OBJECT RESERVES ========
BSS
Plasma.cyclePhase:
DS.W 1
Plasma.cycling:
DS.W 1
Plasma.pallette:
DS.W 1024*2
Plasma.cosTable1:
DS.W 256*3
Plasma.cosTable2:
DS.W 128*3
Plasma.cosTable1a:
DS.W 256*3
Plasma.cosTable2a:
DS.W 128*3
Plasma.baseAdr:
DS.L 1
;======= END OF DEMO-EFFECT OBJECT ========