home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fujiology Archive
/
fujiology_archive_v1_0.iso
/
!FALCON
/
LINEOUT
/
DELTA.ZIP
/
DELTASRC.ZIP
/
DELTA.SRC
/
GALAXY2.SO
< prev
next >
Wrap
Text File
|
2003-01-03
|
15KB
|
759 lines
; Dotted galaxy. Uses random function with various spreading stuffs.
; Looks good with about 5000 stars.
;******* OBJECT EQUATES ********
; You can vary all of these to suit your needs.
Galaxy.DISTANCE: = 500 ; camera distance
Galaxy.DENSITY: = 2 ; sphere's density (spread)
Galaxy.R_START: = $9000 ; startradius (endradius=startradius-$8000)
Galaxy.R_DAMP_LOG: = 9
Galaxy.ARMLENGTH: = 6
Galaxy.MAX_COLOR: = %0110001100001100
RSRESET
Galaxy.sphereTable: RS.W 3*100
Galaxy.restoreTable1: RS.L 10000+1
Galaxy.restoreTable2: RS.L 10000+1
Galaxy.BLOCK_SIZE: RS.B 0
;******* OBJECT TABLE ********
; Must be first in object!!
Galaxy.table:
DC.L Galaxy.mainLoop
DC.L Galaxy.init
DC.L rts
DC.L Galaxy.setFadeIn
DC.L Galaxy.setFadeOut
DC.L Galaxy.setFourArm
DC.L Galaxy.setTwoArm
DC.L Galaxy.setWeirdFourArm
DC.L Galaxy.setThreeArm
DC.L Galaxy.setWeirdArm2
DC.L Galaxy.setWeirdArm3
DC.L Galaxy.setText
DC.L 0
;******* INIT SUBROUTINE ********
; OUTPUT:
; d0.l: =0 all clear, <0 error
Galaxy.init:
move.l #Galaxy.BLOCK_SIZE,d0
bsr.l Mem.register
.success:
moveq #0,d0
rts
.error: moveq #-1,d0
rts
;******* REALTIME INIT SUBROUTINE ********
Galaxy.realtimeInit:
move.l #rts,vbl_gfx
bsr.l Mem.getBlock
move.l d0,Galaxy.baseAdr
lea Galaxy.restoreAddress,a0
movea.l Galaxy.baseAdr,a1
adda.l #Galaxy.restoreTable1,a1
move.l a1,(a0)+
clr.l (a1) ; Clear dotcount!!!
movea.l Galaxy.baseAdr,a1
adda.l #Galaxy.restoreTable2,a1
move.l a1,(a0)+
clr.l (a1) ; Clear dotcount!!!
; Kicks in P56 DSP-program..
move.l #(Galaxy.p56End-Galaxy.p56)/3,d0
lea Galaxy.p56,a0
bsr.l Dsp.loadProgram
move.w #-1,Galaxy.textNum
bsr.w Galaxy.setText
; bsr.w Galaxy.setFourArm
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 #vga60_16bit_320_200,Galaxy.resRout
rts
.vga100:move.l #vga100_16bit_320_200,Galaxy.resRout
rts
.rgb50: move.l #rgb50_16bit_320_200,Galaxy.resRout
rts
;******* SCREENINIT SUBROUTINE ********
Galaxy.initScreen:
IFEQ testmode
movea.l scr,a0
bsr.l CLEAR_320200TSCR
ENDC
rts
;******* MAINLOOP SUBROUTINE ********
Galaxy.mainLoop:
move.l frmcnt,d0
sub.l lastframecount,d0
bne.s .end_realtime_init
move.l d0,-(sp)
bsr.w Galaxy.realtimeInit
move.l (sp)+,d0
.end_realtime_init:
cmpi.l #3,d0
bhs.s .end_screeninit
bsr.w Galaxy.initScreen
.end_screeninit:
; Perform fade-step if needed.
bsr.w Galaxy.fadeIt
movea.l Galaxy.paintRout,a0
jsr (a0)
lea scr,a0
move.l (a0)+,d0
move.l (a0),-4(a0)
move.l d0,(a0)
movea.l Galaxy.resRout,a0
suba.l a1,a1
movea.l d0,a2
bsr.l Screen.requestUpdate
clr.l Galaxy.resRout
move.w $0468.w,d0
.wait: cmp.w $0468.w,d0
beq.s .wait
rts
;******* OBJECT SUBROUTINES ********
Galaxy.setText:
move.l #Galaxy.paintText,Galaxy.paintRout
addq.w #1,Galaxy.textNum
move.w #2,Galaxy.framesToClear
rts
Galaxy.setFadeIn:
move.w #1,Galaxy.fade
rts
Galaxy.setFadeOut
move.w #-1,Galaxy.fade
rts
Galaxy.setFourArm:
move.l #Galaxy.paint3d,Galaxy.paintRout
move.w #4,Galaxy.arms
move.w #45,Galaxy.armSize
move.w #10*sintbllen/9,Galaxy.angle
st Galaxy.new ; Indicate new galaxy pending.
rts
Galaxy.setTwoArm:
move.l #Galaxy.paint3d,Galaxy.paintRout
move.w #2,Galaxy.arms
move.w #60,Galaxy.armSize
move.w #sintbllen*5/7,Galaxy.angle
st Galaxy.new ; Indicate new galaxy pending.
rts
Galaxy.setWeirdFourArm:
move.l #Galaxy.paint3d,Galaxy.paintRout
move.w #4,Galaxy.arms
move.w #45,Galaxy.armSize
move.w #sintbllen/2,Galaxy.angle
st Galaxy.new ; Indicate new galaxy pending.
rts
Galaxy.setThreeArm:
move.l #Galaxy.paint3d,Galaxy.paintRout
move.w #3,Galaxy.arms
move.w #50,Galaxy.armSize
move.w #sintbllen/2,Galaxy.angle
st Galaxy.new ; Indicate new galaxy pending.
rts
Galaxy.setWeirdArm2:
move.l #Galaxy.paint3d,Galaxy.paintRout
move.w #4,Galaxy.arms
move.w #45,Galaxy.armSize
move.w #sintbllen*4/7,Galaxy.angle
st Galaxy.new ; Indicate new galaxy pending.
rts
Galaxy.setWeirdArm3:
move.l #Galaxy.paint3d,Galaxy.paintRout
move.w #3,Galaxy.arms
move.w #50,Galaxy.armSize
move.w #sintbllen*2/3,Galaxy.angle
st Galaxy.new ; Indicate new galaxy pending.
rts
Galaxy.paintText:
IFEQ testmode
movea.l scr,a0
bsr.l CLEAR_320200TSCR
ENDC
move.w Galaxy.textNum,d0
movea.l (Galaxy.textAdrTable,d0.w*4),a4 ; a4: text
movea.l a4,a1
clr.w d2
.lineloop:
; a4: linestart
movea.l a4,a1
move.w #320,d0
; Get linewidth..
lea Font.charTable,a2
clr.w d1
.charloop:
clr.l d3
move.b (a1)+,d3
beq.s .linewidth_calced
subi.b #32,d3
mulu.w #6,d3
add.w 4(a2,d3.l),d1
addq.w #1,d1
bra.s .charloop
.linewidth_calced:
subi.w #320,d1
neg.w d1
bpl.s .ok
clr.w d1
.ok: lsr.w d1
move.l a1,-(sp)
move.w d2,-(sp)
; Paint line..
movea.l scr,a0 ; a0: screen
bsr.l Font.paintText
move.w (sp)+,d2
movea.l (sp)+,a4
addi.w #16,d2 ; d2.w=y offset of next line
tst.b (a4)
bne.s .lineloop
rts
Galaxy.fadeIt:
move.l frmcnt,d0
move.l d0,d1
andi.w #%10,d0
beq.s .right_frame
rts
.right_frame:
tst.w Galaxy.fade
bgt.s .fade_in
bmi.s .fade_out
rts
.fade_in:
andi.w #%01,d1
beq.s .inc_green
addi.w #%0000100000100001,Galaxy.color
cmpi.w #Galaxy.MAX_COLOR,Galaxy.color
bhs.s .ceiling
rts
.inc_green:
addi.w #%0000000000100000,Galaxy.color
cmpi.w #Galaxy.MAX_COLOR,Galaxy.color
bhs.s .ceiling
rts
.fade_out:
andi.w #%01,d1
beq.s .dec_green
subi.w #%0000100000100001,Galaxy.color
bcs.s .floor
rts
.dec_green:
subi.w #%0000000000100000,Galaxy.color
cmpi.w #Galaxy.MAX_COLOR,Galaxy.color
bhs.s .floor
rts
.ceiling:
move.w #Galaxy.MAX_COLOR,Galaxy.color
bra.s .turn_off
.floor: clr.w Galaxy.color
.turn_off:
clr.w Galaxy.fade
rts
; Generates a sphere of quadraticly spread 3d points.
; Linear spread looks too ordinary. Quadratic spread looks good.
; Quatric spread is okay.
; INPUT:
; d0.w=amount of points
; d1.w=radius [0..32767]
; a0: dest buffer
Galaxy.calcSphere:
move.w d0,d7 ; d7.w=points to do
move.l random,d0
.loop:
; Calculate next random value.
move.l d0,d2
mulu.w d0,d0
eor.l d2,d0
addq.l #7,d0
move.w d0,d3
move.l d0,d4
swap d4
rol.l #8,d0
; Calculate next random value.
move.l d0,d2
mulu.w d0,d0
eor.l d2,d0
addq.l #7,d0
move.w d0,d5
rol.l #8,d0
movea.l d3,a3
movea.l d4,a4
movea.l d5,a5
muls.w d3,d3
muls.w d4,d4
muls.w d5,d5
add.l d3,d5
add.l d4,d5
cmpi.l #32767*32767,d5
bhs.s .loop
movem.l d0/d1,-(sp)
move.l d5,d1
bsr.l Math.sqrt
move.l d0,d6
swap d6
movem.l (sp)+,d0/d1
move.l a3,d3
move.l a4,d4
move.l a5,d5
REPT Galaxy.DENSITY
muls.w d6,d3
muls.w d6,d4
muls.w d6,d5
add.l d3,d3
add.l d4,d4
add.l d5,d5
swap d3
swap d4
swap d5
ENDR
muls.w d1,d3
muls.w d1,d4
muls.w d1,d5
add.l d3,d3
add.l d4,d4
add.l d5,d5
swap d3
swap d4
swap d5
move.w d3,(a0)+
move.w d4,(a0)+
move.w d5,(a0)+
subq.w #1,d7
bne .loop
move.l d0,random
rts
; Calculates galaxy points and sends them to the dsp.
; PRE: Var values must be set:
; Galaxy.armSize, Galaxy.armPoints, Galaxy.arms
Galaxy.calc:
move.w Galaxy.armSize,d0
addq.w #1,d0
mulu.w Galaxy.armSize,d0
lsr.l d0
move.w d0,Galaxy.armPoints
move.w Galaxy.arms,d0
mulu.w Galaxy.armPoints,d0
move.l d0,Galaxy.points
sendLongToDsp Galaxy.points
lea sine_tbl,a1
clr.w .c ; c = actual sphere number
.loop: movea.w .c(pc),a5
addq #1,a5
IFNE 1
; [1-cos(pi*t)]/2
move.w .c(pc),d0
move.l #sintbllen,d1
divu.w Galaxy.armSize,d1
mulu.w d1,d0
lsr.l d0
; d0.l=c*sintbllen/(Galaxy.ARMSIZE*2)
Get_Cos a1,d0,d0
asr.w d0
addi.w #$4000,d0
move.w Galaxy.angle,d1
mulu.w d0,d1
add.l d1,d1
swap d1
ELSE
move.w .c(pc),d0
mulu.w d0,d0
move.w Galaxy.armSize,d1
mulu.w d1,d1
move.l d1,d2
sub.w d0,d1
move.l d1,d0
divu.w #$7FFF/Galaxy.ARMSIZE*Galaxy.ARMSIZE,d0
mulu.w #Galaxy.ANGLE/(Galaxy.ARMSIZE*Galaxy.ARMSIZE),d1
ENDC
move.w Galaxy.arms,d6
subq.w #1,d6
.armloop:
; Add angle-step to current angle..
move.l #sintbllen,d2
divu.w Galaxy.arms,d2
add.w d2,d1
Do_SinModulo d1
Get_SinCos a1,d1,d2,d3
muls.w d0,d2
muls.w d0,d3
swap d2
swap d3
asr.w #Galaxy.ARMLENGTH,d2
asr.w #Galaxy.ARMLENGTH,d3
movem.l d0-a6,-(sp)
movea.l Galaxy.baseAdr,a0
adda.l #Galaxy.sphereTable,a0
move.w #Galaxy.R_START,d1
sub.w d0,d1
moveq #Galaxy.R_DAMP_LOG,d0
lsr.w d0,d1
move.w a5,d0
bsr.w Galaxy.calcSphere
movem.l (sp)+,d0-a6
ext.l d2
ext.l d3
move.w a5,d7
subq.w #1,d7
movea.l Galaxy.baseAdr,a2
adda.l #Galaxy.sphereTable,a2
.pointloop:
movem.w (a2)+,d4/d5
add.l d2,d4
add.l d3,d5
sendLongToDsp d4
sendLongToDsp d5
move.w (a2)+,d4
ext.l d4
sendLongToDsp d4
dbf d7,.pointloop
dbf d6,.armloop
move.w .c(pc),d0
addq.w #1,d0
move.w d0,.c
cmp.w Galaxy.armSize,d0
blt .loop
rts
.c: DC.W 0
; Paint a galaxy and possibly refresh.
Galaxy.paint3d:
; Send shape (or null) to dsp.
tst.w Galaxy.new
beq.s .not_new
bsr.w Galaxy.calc
bra.s .end_transfer_shape
.not_new:
sendLongToDsp #0
.end_transfer_shape:
clr.w Galaxy.new
move.l Galaxy.points,d0
; Send over the amount of points to render.
tst.w d0
bne.s .amount_not_zero
addq.w #1,d0
.amount_not_zero:
sendLongToDsp d0
; First send rotation parameters to dsp..
move.w $4bc.w,d0
lsr.w #1,d0
move.w d0,d2
move.w d0,d4
mulu.w #3,d2
lsr.l #2,d2
mulu.w #5,d4
lsr.l #2,d4
Do_SinModulo d0
Do_SinModulo d2
Do_SinModulo d4
lea sine_tbl,a0
Get_SinCos a0,d0,d0,d1
Get_SinCos a0,d2,d2,d3
Get_SinCos a0,d4,d4,d5
lsl.l #8,d0
lsl.l #8,d1
lsl.l #8,d2
lsl.l #8,d3
lsl.l #8,d4
lsl.l #8,d5
sendLongToDsp d0
sendLongToDsp d1
sendLongToDsp d2
sendLongToDsp d3
sendLongToDsp d4
sendLongToDsp d5
; Send the screencenter...
movea.l scr,a0
adda.l #(320*100+160)*2,a0
sendLongToDsp a0
;- parallel cpu/dsp --------------------------------------------------------
; Restore background..
tst.w Galaxy.framesToClear
beq.s .normal_restore
; Wipe whole screen.
subq.w #1,Galaxy.framesToClear
IFEQ testmode
movea.l scr,a0
bsr.l CLEAR_320200TSCR
ENDC
bra.w .end_restore
.normal_restore:
movea.l Galaxy.restoreAddress,a3
move.l (a3)+,d7
beq.w .end_restore
move.w d7,d1
lsr.w #5,d7
andi.w #(1<<5)-1,d1
neg.w d1
clr.w d0
jmp (.jumpend.w,pc,d1.w*4)
.restore_loop:
REPT 1<<5
movea.l (a3)+,a0
move.w d0,(a0)
ENDR
.jumpend:
dbf d7,.restore_loop
.end_restore:
;- end of parallel part ----------------------------------------------------
; Receive and paint! NOTE: can only be painted to STRAM!
movea.l Galaxy.restoreAddress,a3
moveq #$ffffffff,d4
move.l #$00ffffff,d5
move.w Galaxy.color,d6
lea $ffffa204.w,a1
clr.l d7
receiveWordFromDsp d7
move.l d7,(a3)+
beq.s .end_plot
IFNE 1
; Unrolled version, this is just that bit faster!
move.w d7,d1
lsr.w #3,d7
andi.w #(1<<3)-1,d1
mulu.w #10,d1
neg.l d1
jmp (.jump.w,pc,d1.l)
.loop:
REPT 1<<3
movea.l (a1),a0
move.l a0,(a3)+
add.w d6,(a0)
bcc.s *+4 ;.next
move.w d4,(a0)
ENDR
.jump: dbf d7,.loop
ELSE
; Simple version, just a tad too slow..
subq.w #1,d7
.loop: movea.l (a1),a0
move.l a0,(a3)+
add.w d6,(a0)
bcc.s .next
move.w d4,(a0)
.next: dbf d7,.loop
ENDC
.end_plot:
; Swap restore table addresses.
lea Galaxy.restoreAddress,a0
move.l (a0)+,d0
move.l (a0),-4(a0)
move.l d0,(a0)
rts
;******* OBJECT DATA ********
DATA
Galaxy.p56:
INCBIN GALAXY2.P56
Galaxy.p56End:
EVEN
Galaxy.textAdrTable:
DC.L Galaxy.text1
DC.L Galaxy.text2
DC.L Galaxy.text3
DC.L Galaxy.text4
DC.L Galaxy.text5
DC.L Galaxy.text6
DC.L Galaxy.text7
Galaxy.text1:
DC.B " ",0," ",0," ",0," ",0," ",0
DC.B "all these worlds are yours",0,0
; HOLOCAUST, HEMOROIDS
Galaxy.text2:
DC.B " ",0," ",0," ",0
DC.B "aggression altair art aura avena",0
DC.B "blindio checkpoint cih cobra cream",0
DC.B "deltaforce dhs dune eko ephidrena",0
DC.B "equinox escape exa fit fun giants",0
DC.B "hydroxid indus inter kalms lazer",0
DC.B "mind design mr ni mystic bytes nature",0
DC.B "newbeat nocrew ochrana omega",0,0
Galaxy.text3:
DC.B " ",0," ",0," ",0
DC.B "overlanders oxygene ozk paranoia",0
DC.B "phf pov remo reservoir gods",0
DC.B "richard karsmakers scoopex sectorone",0
DC.B "sentry silents st survivor supremacy",0
DC.B "sync taquart teenage therapy tlb",0
DC.B "tnb toys tristan tscc ulm wildfire",0
DC.B "yescrew ym rockerz x-troll",0,0
Galaxy.text4:
DC.B "credits for delta",0
DC.B " ",0," ",0
DC.B "code:",0
DC.B "earx",0
DC.B " ",0
DC.B "graphics:",0
DC.B "evl havoc",0
DC.B " ",0
DC.B "music:",0
DC.B "dforce earx frequent laxical",0
DC.B 0
Galaxy.text5:
DC.B "inspiration",0
DC.B " ",0," ",0
DC.B "lucky of st",0
DC.B "newface",0
DC.B "no",0
DC.B "tat",0
DC.B " ",0
DC.B "imminent",0
DC.B "lustmord",0
DC.B "terror against terror",0,0
Galaxy.text6:
DC.B " ",0," ",0," ",0
DC.B "if you want to like this demo as much",0
DC.B "as we liked making it...",0
DC.B " ",0
DC.B " ",0
DC.B "...feel free to watch for three years",0,0
Galaxy.text7:
DC.B " ",0," ",0," ",0," ",0
DC.B "stay cool",0
DC.B "stay atari",0
DC.B " ",0
DC.B "lineout 2002/2003",0,0
EVEN
;******* OBJECT RESERVES ********
BSS
Galaxy.baseAdr:
DS.L 1
Galaxy.restoreAddress:
DS.L 2
Galaxy.arms:
DS.W 1 ; #arms in galaxy
Galaxy.distance:
DS.W 1 ; camera distance
Galaxy.rStart:
DS.W 1 ; startradius (endradius=startradius-$8000)
Galaxy.rDampLog:
DS.W 1
Galaxy.armLength:
DS.W 1
Galaxy.armSize:
DS.W 1
Galaxy.angle:
DS.W 1 ; arm's final angle
Galaxy.armPoints:
DS.W 1
Galaxy.points:
DS.L 1 ; #points in galaxy
Galaxy.startTime:
DS.W 1
Galaxy.new:
DS.W 1 ; new galaxy pending?
Galaxy.fade:
DS.W 1 ; fade direction (-1,0,+1)
Galaxy.color:
DS.W 1
Galaxy.framesToClear:
DS.W 1
Galaxy.paintRout:
DS.L 1
Galaxy.resRout:
DS.L 1
Galaxy.textNum:
DS.W 1
;******* END OF DEMO-EFFECT OBJECT ********