TITLE programme test des fonction 3dgraph

DOSSEG
.MODEL LARGE
.STACK 500H
.486


INCLUDE FREE_OVE.FNC
INCLUDE FLAT.FNC
INCLUDE 3DGRAPH.FNC
INCLUDE CLAVIER.FNC
INCLUDE FICHIER.FNC
INCLUDE IMAGE.FNC
INCLUDE MEMOIRE.FNC

.DATA
 BUFFER_IMAGE DD 0
 PALETTE DB 768 DUP(?)

.CODE
START:
 FREE_OVER_MEM     ;lib‚re la m‚moire non utilis‚
 FLAT_MODE         ;Passe au mode FLAT FS,GS,DS,ES sont agrandis … 4Go
 NEW_KEY
 FIXE_ADRESSE_DTA

 ALLOUE_MEM_BASSE 4000
 MOV BUFFER_IMAGE,EAX

 MOV AX,0013H
 INT 10H

 MOV DX,3C8H
 MOV AL,0
 OUT DX,AL
 INC DX

 MOV CX,256
 @pal:
  MOV BX,CX
  DEC BX
  SHR BX,2
  MOV AL,63
  SUB AL,BL

  OUT DX,AL
  OUT DX,AL
  OUT DX,AL
 loop @pal



 CHARGE_IMAGE_PCX "olivier.pcx",BUFFER_IMAGE
 MOV EAX,@DATA
 SHL EAX,4
 ADD EAX,offset PALETTE
 CHARGE_PALETTE_PCX "olivier.pcx",EAX
 MOV EAX,@DATA
 SHL EAX,4
 ADD EAX,offset PALETTE
 ACTIVE_PALETTE EAX,0,256

@MAIN:
 ;copy le buffer sur l'‚cran
  DEPLACE_BLOCK_MEMOIRE BUFFER_IMAGE,0A0000H,64000

 ;‚fface le buffer
  PUSH DS
   MOV CX,64000
   MOV EDI,BUFFER_IMAGE
   XOR AX,AX
   MOV DS,AX
   @CLS:
    MOV [EDI],AL
    INC EDI
   LOOP @CLS
  POP DS

 ;copy la portion 160*100 zoom‚ … 320*200 dans le buffer
  MOV EDI,BUFFER_IMAGE
  PUSH DS
  MOV ESI,0A0000H
  XOR AX,AX
  MOV DS,AX
  ADD ESI,80+320*50
  MOV CX,100
  @boucle1:
  PUSH CX
   MOV CX,160
   @boucle2:
    MOV AL,[ESI]
    MOV [EDI],AL
    INC ESI
    ADD EDI,2
   LOOP @boucle2
  ADD EDI,320
  ADD ESI,160
  POP CX
  LOOP @boucle1
  POP DS

@n2: key 2
jne @n2

; ;effectue le filtrage du buffer
  PUSH BUFFER_IMAGE
  PUSH DWORD PTR 320
  PUSH DWORD PTR 200
  CALL SR_FILTRE_BILINEAIRE_IMAGE_MONO

@o2: key 2
je @o2


KEY 1
JNE @MAIN

 MOV AX,0003H
 INT 10H

 LIBERE_MEM_BASSE BUFFER_IMAGE
 HOLD_KEY
 MOV AX,4C00H
 INT 21H

END START
