Files
templates/Labv4.cpp
Mark Zheleznyakov be2b9502d1 init
2024-09-07 08:49:36 +03:00

141 lines
2.8 KiB
C++
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ‹ ¡®à â®à­ ï <20> ¡®â  Lab 4
// €‰Œ…<C592>. ˆ§¬¥à¥­¨¥ ¢à¥¬¥­¨. Œëèì
//
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
long int cl2,cl1,c1,c2;
unsigned long int t1,t2,t3;
// ˆ§¬¥­¥­¨¥ ª®­áâ ­âë áç¥â稪 
/* asm{
mov ax,00110110B // 00 11 011 0
out 43h,ax
mov ax,0000000000000000B
out 40h,al
mov al,ah
out 40h,al
}
*/
// ˆ§¬¥à¥­¨¥ ¢à¥¬¥­¨ ¢ë¯®«­¥­¨ï â¥á⮢®© ¯à®£à ¬¬ë 1
// ¢ ⨪ å (¢ ¯à¥à뢠­¨ïå ®â 0-£® ª ­ «  â ©¬¥à )
// ‘ç¥â稪 ⨪®¢ ï祩ª  46 - ¬« ¤è¨© ¡ ©â ¯¥à¢ë©
asm{
mov ax,0x46
mov es,ax
mov bx,0xC
mov ax,[es:bx]
mov cx,[es:(bx+2)]
}
// ‡ ¯®¬­¨â¥ ­ ç «ì­®¥ §­ ç¥­¨¥ ¬« ¤è¥¥ ¨ áâ à襥 ???
// cl2= ; cl1= ;
c1=cl2+cl1*0x10000;
//’¥á⮢ ï ¯à®£à ¬¬  1
asm mov cx,1000
met1: asm {
push cx
mov cx,1000
}
met2: asm {
loop met2
pop cx
loop met1
}
//
asm{
mov ax,0x46
mov es,ax
mov bx,0xC
mov ax,[es:bx]
mov cx,[es:(bx+2)]
}
// ‡ ¯®¬­¨â¥ ª®­¥ç­®¥ §­ ç¥­¨¥ ???
// cl2=_AX; cl1= ;
// „«¨­­®¥ 楫®¥ -
c2=cl2+cl1*0x10000;
// clrscr();
// printf("\n<>¥à¢®¥ - %d\n",c1);
// printf("‚â®à®¥ - %d\n",c2);
cout<<"\n‚à¥¬ï ¢ë¯®«­¥­¨ï â¥á⮢®© ¯à®£à ¬¬ë 1\n";
cout<<"COUNTs: "<<c2-c1<<"\n";
printf("\n ‘ª®«ìª® ¬¨««¨á¥ªã­¤ ??");
getch();
// ˆ§¬¥à¥­¨¥ ¢à¥¬¥­¨ ¢ë¯®«­¥­¨ï â¥á⮢®© ¯à®£à ¬¬ë
// ¯® ᮤ¥à¦¨¬®¬ã ॣ¨áâà  â ©¬¥à 
// <20>®àâ 43h - ¯®àâ ã¯à ¢«¥­¨ï â ©¬¥à®¬
// <20>®àâ 40h - ¯®àâ â ©¬¥à 
asm{
mov ax,00000110B // 00 00 011 0
out 43h,ax // —¨â ¥¬ ¬« ¤è¨©, ¯®â®¬ áâ à訩
in al,40h
// mov bl,al
in al,40h
// mov ah,al
// mov al,bl
}
t1=_AX;
//’¥á⮢ ï ¯à®£à ¬¬  2
asm mov cx,1
met11: asm {
push cx
mov cx,1000
}
met22: asm {
loop met22
pop cx
loop met11
}
asm{
mov ax,00000110B // 00 00 011 0
out 43h,ax // —¨â ¥¬ ¬« ¤è¨©, ¯®â®¬ áâ à訩
in al,40h
// mov bl,al
in al,40h
// mov ah,al
// mov al,bl
}
t2=_AX;
t3=t1; // ????
clrscr();
printf("\n<EFBFBD>¥à¢®¥ - %d \n",t1);
printf("‚â®à®¥ - %d\n",t2);
cout<<"\n‚à¥¬ï ¢ë¯®«­¥­¨ï â¥á⮢®© ¯à®£à ¬¬ë 2\n";
printf("%x\n",t3);
cout<<"CLOCKs: "<<t3<<"\n";
printf("\n ‘ª®«ìª® ¬¨ªà®á¥ªã­¤ ??");
getch();
// ‡ ¤ ­¨ï
// 1 Ž¯à¥¤¥«¨â¥ ¢à¥¬¥­  à ¡®âë â¥á⮢ëå ¯à®£à ¬¬ 1 ¨ 2
// 2 <20>¥à¥¯à®£à ¬¬¨àã©â¥ â ©¬¥à ¨ ¨§¬¥àì⥠¢à¥¬ï à ¡ ¯à®£1 ¡®«¥¥ â®ç­®
// 3 Ž¯à¥¤¥«¨â¥ ¢à¥¬ï ¬¥¦¤ã ¤¢ã¬ï ­ ¦ â¨ï¬¨ ­  ª­®¯ªã ¬ëè¨ (¨«¨ ª« ¢¨ âãàë)
//<2F>â  ¯à®æ¥¤ãà  áç¨â뢠¥â ¯®«®¦¥­¨¥ ªãàá®à  ¬ëè¨ ¨ ¯à¨§­ ª ­ ¦ â¨ï
//­  ª« ¢¨èã. <20>à®ç¨â ©â¥ ®¯¨á ­¨¥ ¤à ©¢¥à  ¬ëè¨ ¨ ¯à®£à ¬¬ã Asmous.cpp.
void ReadMouse ()
{
asm mov ax, 0x3
asm int 0x33
asm mov MouseB, bx
asm mov MouseX, cx
asm mov MouseY, dx
}
}