home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Equalizer BBS
/
equalizer-bbs-collection_2004.zip
/
equalizer-bbs-collection
/
DEMOSCENE-STUFF
/
TUNNEL.ZIP
/
TUNNEL.ASM
< prev
next >
Wrap
Assembly Source File
|
1994-11-26
|
9KB
|
278 lines
;***************************************************************************
;
; TUNNEL
;
;***************************************************************************
;
; Par jean-christophe Harivel
;
;***************************************************************************
;
; Prévu pour etre compilé avec TASM 3.1
;
;***************************************************************************
;
; C'est mon premiere essai avec l'ASM, alors un peu d'indulgence ;)
; Moi j'ai beaucoups apris,j'espere qu'il vous apprendra aussi...
;
;***************************************************************************
DOSSEG
.MODEL small
.STACK 10h
.DATA
px dw 2048d dup (7fffh)
py dw 2048d dup (7fffh)
pz dw 2048d dup (?)
old dw 2048d dup (0fffh)
tps dw 0
tps2 dw 0
tps3 dw 0
costable dw 18d, 44d, 69d, 94d, 119d, 144d, 169d, 194d, 219d, 243d
dw 268d, 292d, 316d, 340d, 364d, 387d, 410d, 433d, 456d, 478d
dw 501d, 522d, 544d, 565d, 586d, 606d, 627d, 646d, 666d, 685d
dw 703d, 721d, 739d, 756d, 773d, 789d, 805d, 820d, 835d, 850d
dw 863d, 877d, 889d, 902d, 913d, 924d, 935d, 945d, 954d, 963d
dw 971d, 979d, 986d, 993d, 998d, 1004d, 1008d, 1012d, 1016d, 1019d
dw 1021d, 1022d, 1023d
sintable dw 1024d, 1023d, 1022d, 1021d, 1019d, 1016d, 1012d, 1008d, 1004d, 998d
dw 993d, 986d, 979d, 971d, 963d, 954d, 945d, 935d, 924d, 913d
dw 902d, 889d, 877d, 863d, 850d, 835d, 820d, 805d, 789d, 773d
dw 756d, 739d, 721d, 703d, 685d, 666d, 646d, 627d, 606d, 586d
dw 565d, 544d, 522d, 501d, 478d, 478d, 456d, 433d, 410d, 387d
dw 364d, 340d, 316d, 292d, 268d, 243d, 219d, 194d, 169d, 144d
dw 119d, 94d, 69d, 44d, 18d, -6d, -31d, -56d, -81d, -107d
dw -132d, -157d, -181d, -206d, -231d, -255d, -280d, -304d, -328d, -352d
dw -375d, -399d, -422d, -445d, -467d, -489d, -511d, -533d, -555d, -576d
dw -596d, -617d, -637d, -656d, -675d, -694d, -712d, -730d, -748d, -765d
dw -781d, -797d, -813d, -828d, -843d, -857d, -870d, -883d, -896d, -908d
dw -919d, -930d, -940d, -950d, -959d, -967d, -975d, -983d, -989d, -996d
dw -1001d,-1006d,-1010d,-1014d,-1017d,-1020d,-1022d,-1023d,-1024d,-1024d
dw -1023d,-1022d,-1020d,-1017d,-1014d,-1010d,-1006d,-1001d, -996d, -989d
dw -983d, -975d, -967d, -959d, -950d, -940d, -930d, -919d, -908d, -896d
dw -883d, -870d, -857d, -843d, -828d, -813d, -797d, -781d, -765d, -748d
dw -730d, -712d, -694d, -675d, -656d, -637d, -617d, -596d, -576d, -555d
dw -533d, -511d, -489d, -467d, -445d, -422d, -399d, -375d, -352d, -328d
dw -304d, -280d, -255d, -231d, -206d, -181d, -157d, -132d, -107d, -81d
dw -56d, -31d, -6d, 18d, 44d, 69d, 94d, 119d, 144d, 169d
dw 194d, 219d, 243d, 268d, 292d, 316d, 340d, 364d, 387d, 410d
dw 433d, 456d, 478d, 501d, 522d, 544d, 565d, 586d, 606d, 627d
dw 646d, 666d, 685d, 703d, 721d, 739d, 756d, 773d, 789d, 805d
dw 820d, 835d, 850d, 863d, 877d, 889d, 902d, 913d, 924d, 935d
dw 945d, 954d, 963d, 971d, 979d, 986d, 993d, 998d, 1004d, 1008d
dw 1012d, 1016d, 1019d, 1021d, 1022d, 1023d
palette db 0, 3, 5, 6, 7, 8, 9,10,11,12,13,13,14,15,16,17
db 17,18,19,20,21,22,23,24,24,25,26,27,28,29,30,31
db 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
db 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
db 63,63,63,63,63,62,62,62,62,61,61,61,60,60,59,58
db 58,58,57,57,57,56,56,56,55,55,55,54,54,54,53,53
db 53,52,52,52,51,51,51,50,50,50,49,49,49,48,48,48
db 47,47,47,46,46,46,45,45,45,44,44,44,43,43,43,43
db 41,41,41,40,40,40,40,39,39,39,38,38,38,37,37,37
db 37,36,36,36,35,35,35,34,34,34,33,33,33,32,32,32
db 31,31,31,30,30,30,31,31,31,31,30,30,30,38,28,28
db 27,27,27,26,26,26,25,25,25,24,24,24,23,23,23,22
db 22,22,21,21,21,20,20,20,19,19,19,18,18,17,17,17
db 16,16,15,15,15,14,14,14,13,13,12,12,12,11,11,11
db 10,10,10, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 6, 6, 6
db 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2
.CODE
mov ax,@data ;on positionne les pointeurs de segment
mov ds,ax
mov ax,0a000h
mov es,ax
mov ax,0013h ;vga please !
int 10h
;***************************************************************************
mov cx,0ffh ;on initialise la palette
xor ax,ax
mov si,offset palette
palette_loop:
mov dx,3c8h
mov al,ah
out dx,al
mov dx,3c9h
mov al,[si]
out dx,al
out dx,al
out dx,al
inc si
inc ah
loop palette_loop
;***************************************************************************
mov cx,2046d ;on initialise pz
mov si,offset pz
init_pz:
mov ax,cx
cwd
mov bx,128d
div bx
sal dx,1
mov [si],dx
inc si
inc si
loop init_pz
;***************************************************************************
Main_loop_begin:
mov cx,2048d ;decalage des points du tunnel
xor si,si
anim_loop:
mov di,old[si] ;d'abords on efface
mov byte ptr es:[di],0000h ;un point tout noir! un!
mov ax,pz[si]
cmp ax,3d ;si pz < 3 saut a "remettre a 0"
jb reset_px_py_pz
sub ax,2d ;sinon reduit pz de 2
mov pz[si],ax
anim_end:
push ax ;ax est toujours sur pz
add ax,32d ;et on y ajoute 32 pour pas faire merder
push ax ;la division
push ax
mov ax,px[si] ;coordonnees en x
cwd
pop bx
idiv bx
add ax,160d ;+160 pour recentrer
mov bx,ax
cmp ax,319d ;si x hors de l'ecran
ja calcul_out_1 ;pas la peine d'aller plus loin
mov ax,py[si] ;coordonnees en y
cwd
pop di
idiv di
add ax,100d ;+100 pour recentrer
cmp ax,199d ;si y hors de l'ecran
ja calcul_out_2 ;pas la peine d'aller plus loin
mov di,320d
mul di ;calcul l'offset du pixel
add ax,bx
mov old[si],ax ;on le sauve dans old
mov di,ax ;on l'affiche
pop ax
mov es:[di],ax
jmp calcul_end
calcul_out_1:
pop ax
calcul_out_2:
pop ax
;on entre une valeure hors de l'ecran
mov word ptr old[si],64001d ;pour ne rien afficher
;***************************************************************************
calcul_end:
inc si
inc si
loop anim_loop
jmp reset_end
;---------------------------------------------------------------------------
reset_px_py_pz:
push si ;on calcul x
mov si,tps
mov ax,sintable[si] ;on recupere sin(tps)
mov dx,12d
imul dx
mov di,ax ;on sauve tous ca dans di
mov si,tps2
mov ax,sintable[si] ;on récupere sin(tps2)
mov bx,3d
imul bx
add ax,di ;on additionne les deux sinus
pop si
mov px[si],ax ;et on le stock
push si ;on calcul y
mov si,tps
mov ax,costable[si] ;on récupere cos(tps)
mov dx,7d
imul dx
mov di,ax
sal si,1 ;on sauve dans di
mov si,tps3
mov ax,costable[si] ;on récupere cos(tps3)
mov dx,2d
imul dx
add ax,di
pop si
mov py[si],ax ;et on le stock
mov ax,tps
add tps,18d
and tps,0111111111b
mov ax,254d
mov word ptr pz[si],ax ;on remet pz a 254
jmp anim_end
reset_end:
;***************************************************************************
add tps2,4 ;on incrémente tps2 et tps3
and tps2,0111111111b
add tps3,2
and tps3,0111111111b
mov dx,3dah ;on attends sagement le retour du signal
VBL_loop:
in al,dx
test al,8
jz VBL_loop
;***************************************************************************
mov dx,0060h ;on a appuyé sur une touche ?
in al,dx
cmp al,80
jb main_loop_end
jmp Main_loop_begin
main_loop_end: ;oui... alors kassos!
mov ax,0003h
int 10h
mov ah,4ch
int 21h
END