TITLE programme test des fonction 3dgraph

DOSSEG
.MODEL LARGE
.STACK 500H
.486


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


.DATA
 MODE_information MODE_info<?>
 BUFFER_IMAGE DD 0
 BUFFER_IMAGE16 DD 0

 PALETTE DB 768 DUP(?)
 HANDLE_buffer DW 0
 HANDLE_buffer16 DW 0

 numero_bank DW 0
 INC_bank    DW 0

.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
 GET_HIMEM_ADRESSE
 ACTIVE_A20

 GET_HIMEM_EMB 451
 MOV HANDLE_buffer,DX
 GET_HIMEM_EMBadresse DX
 SHL EDX,16
 MOV DX,BX
 MOV BUFFER_IMAGE,EDX

 GET_HIMEM_EMB 451
 MOV HANDLE_buffer16,DX
 GET_HIMEM_EMBadresse DX
 SHL EDX,16
 MOV DX,BX
 MOV BUFFER_IMAGE16,EDX


 PUSH WORD PTR 111H
 CALL SR_SET_SVGA_MODE
 PUSH 111H
 PUSH SEG MODE_information
 PUSH OFFSET MODE_information
 CALL SR_RETURN_MODE_INFO

 CHARGE_IMAGE_PCX "test2.pcx",BUFFER_IMAGE
 MOV EAX,@DATA
 SHL EAX,4
 ADD EAX,offset PALETTE
 CHARGE_PALETTE_PCX "test2.pcx",EAX

 PUSH DWORD PTR BUFFER_IMAGE
 PUSH DWORD PTR BUFFER_IMAGE16
 MOV EAX,@DATA
 SHL EAX,4
 ADD EAX,offset palette
 PUSH EAX
 PUSH DWORD PTR 64000
 CALL SR_CONVERT_IMAGE8_IMAGE16

 PUSH DWORD PTR BUFFER_image16
 PUSH DWORD PTR BUFFER_image
 PUSH DWORD PTR 320
 PUSH DWORD PTR 200
 CALL SR_ZOOM2_IMAGE16

;Copy l'image sur l'ecran
 MOV AX,MODE_information.WinSize
 XOR DX,DX
 DIV WORD PTR MODE_information.WinGranularity
 MOV INC_bank,AX

MOV ECX,160
@boucle:
push Ecx
push buffer_image
shl ecx,1
Add buffer_image,ECX

 MOV BX,0
 MOV DX,0
 CALL DWORD PTR MODE_information.WinFuncPtr
 MOV numero_bank,0

MOV CX,8
@boucle_copy:
push cx

 mov ax,mode_information.WinSize
 AND EAX,0FFFFH
 SHL EAX,10
 deplace_block_memoire buffer_image,0A0000H,eax

 ;change de bank

 MOV AX,MODE_information.WinSize
 AND EAX,0FFFFH
 SHL EAX,10
 ADD BUFFER_IMAGE,EAX

 MOV AX,INC_bank
 ADD numero_bank,ax

 MOV BX,0
 MOV DX,numero_bank
 CALL DWORD PTR MODE_information.WinFuncPtr

pop cx
loop @boucle_copy
pop buffer_image
pop Ecx
loop @boucle

 @wait_esc: key 1
 JNE @wait_esc


 MOV AX,0003H
 INT 10H

 FREE_HIMEM_EMB HANDLE_BUFFER
 FREE_HIMEM_EMB HANDLE_BUFFER16

 HOLD_KEY          ;restitut le clavier
 MOV AX,4C00H      ;retourne au dos
 INT 21H
END START
