

[BITS 16]

[SEGMENT .text]

org 100h

start:
  

  mov ah,4ah
  mov bx,4096
  int 21h
  
  call InitMem
  call PrepareSinus

  mov es,[plasma]
  call ClearSeg
  call DoPlasma

  mov es,[cs:mplasma]
  mov ds,[cs:plasma]
  call CopySeg
  push cs
  pop ds

  mov di,256*(56-16)+8
  mov si,Allergy
  mov ah,63
  call PutText
  mov di,256*(56+16)+1
  mov si,Presents
  mov ah,63
  call PutText

  mov es,[t_angles]
  mov fs,[t_depths]
  call PrepareTunnel

  mov es,[enviro]
  call PrepareBump
  
  call StartTimer

  mov ax,13h
  int 10h
  call SetPaletteTunnel
  call WhiteFlash
  call Effet_CubePresent

  call WhiteFlash
  call Effet_Naiade
  call Effet_Rotozoom
  call WhiteFlash
  
  mov es,[enviro]
  xor cx,cx
  .loop_divide_enviro
    mov al,[es:di]
    shr al,1
    stosb
  loop .loop_divide_enviro
  call Effet_Tunnel
  call WhiteFlash

  call Effet_Fontaine
  call WhiteFlash

;  call Make_Pal_VBalls

;  mov es,[screen]
;  mov di, 320*10+10
;  call Aff_Ball
;  xor ah,ah
;  int 16h


;------
;  call DoGreetz

;  mov dword [Timer],0
;  .loop_t:
;    mov es,[virt]
;    xor cx,cx
;    xor bx,bx
;    xor di,di
;    mov dl,[Timer]
;    .test_water_loop:
;      mov bh,0
;      mov bl,cl
;      add bl,dl
;      shl bx,5
;      and bx,511
;      mov ax,[bx+Sin]
;      sar ax,1
;      add ax,128
;      shr ax,2
;      stosb
;    loop .test_water_loop

;    mov es,[virt2]
;    mov fs,[virt]
;    mov gs,[enviro]
;    call DoBump

;    mov fs,[virt2]
;    mov es,[screen]
;    call WaitVBL
;    call Virt2Scr

;  cmp word [Timer],512
;  jb .loop_t
  

;------


  push cs
  pop ds


  mov ax,3h
  int 10h

  call StopTimer

int 20h
;ret


%include "_system.inc"
%include "_timer.inc"
%include "_vga.inc"
%include "_math.inc"
%include "_font.inc"
%include "_palette.inc"
%include "_fire.inc"
%include "_tunnel.inc"
%include "_plasma.inc"
%include "_bump.inc"
%include "_3d.inc"
%include "_poly.inc"
%include "_roto.inc"
%include "_partic.inc"
%include "_effets.inc"
; %include "_greets.inc"
; %include "_vballs.inc"

Allergy  db 'Allergy',0
Presents db 'presents',0
Naiade   db 'NAIADE',0
;DiRoto   dw 0
huit_64  dd 40404040h
         dd 40404040h
screen   dw 0a000h
virt     dw 0
partic:
virt2    dw 0
plasma   dw 0
mplasma  dw 0
enviro   dw 0
t_angles dw 0
t_depths dw 0
