Program pre otáčanie texturou pomocou kolineránich transformácií

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Kategória: KMP (Klub mladých programátorov)
krychle.pngProgram: Krychle.pasU_crt.pasU_graf13.pasU_znacka.pas
Súbor exe: Krychle.exe
Potrebné: Textura2.bmpTextura2.obj

Program pre otáčanie texturou pomocou kolineránich transformácií.
{ u_crt.pas                                                          }
{ Unit pre krychle.pas                                               }
{                                                                    }
{ Author:                                                            }
{ Datum:02.02.2008                              http://www.trsek.com }
 
{$D-,E-,G+,I-,L-,N-,P+,Q-,R-,S-,T-,V-,Y- exe}
Unit U_CRT;
Interface
Var
   {cas}
   Time     : Longint ABSOLUTE $0:$046c;  {div 27.2?}
 
 
Function KeyPressed:Boolean;
Function ReadKey:Char;
Procedure  Delay27(MSdiv27: Word);
Procedure Pause;
 
Implementation
Const ScanCode:Byte=0;
 
Procedure Pause;
Begin
   While KeyPressed do ReadKey;
   Repeat Until KeyPressed;
   While KeyPressed do ReadKey;
End;
 
 
Function KeyPressed:Boolean; Assembler;
Asm
  CMP  ScanCode,0     {ZF := ((ScanCode AND 0) = 0)}
  JNE  @@1            {IF Not ZF 0 Then GOTO 1}
  MOV  AH,1           {AH := 1, INT 16h cte ale nevyjme z bufferu}
  INT  16H            {AL := ASCII kod znaku; AH := SCAN kod znaku; ZF = NeniStisk}
  MOV  AL,0           {AL := 0}
  JE   @@2            {IF ZF THEN GOTO 2}
@@1:MOV  AL,1         {AL := 1}
@@2:                  {KeyPressed := AL}
End;
 
 
Function ReadKey:Char; Assembler;
Asm
  MOV  AL,ScanCode    {AL := ScanCode}
  MOV  ScanCode,0     {ScanCode := 0}
  OR   AL,AL          {ZF := ((AL OR AL) = 0)}
  JNE  @@1            {IF Not ZF THEN GOTO 1 Byla stisknuta klavesa s kodem 0, napr. F1}
  XOR  AH,AH          {AH := 0, INT 16h pak cte znak z klavesnice}
  INT  16H            {AL := ASCII kod znaku; AH := SCAN kod znaku}
  OR   AL,AL          {ZF := ((AL OR AL) = 0)}
  JNE  @@1            {IF Not ZF Then GOTO 1}
  MOV  ScanCode,AH    {ScanCode := AH ulozeno pro pristi pouziti}
  OR   AH,AH          {ZF := ((AH OR AH) = 0)}
  JNE  @@1            {IF Not ZF Then GOTO 1}
  MOV  AL,'C'-64      {AL := 3}
@@1:                  {ReadKey := AL}
End;
 
Procedure Delay27(MSdiv27:Word);
Var T:LongInt;
Begin
   While MSdiv27 > 0 Do
   Begin
    T := Time;
    While T = Time Do;
      MSdiv27 := MSdiv27 - 1;
   End;
End;
 
 
End.