i2save » 14 янв 2015, 20:21
Приветствую! Нуждаюсь в описании асемблерных вставок. Желателен комментарий каждой строчки
Код: Выделить всё
int isrctrl()
{
int r;
asm{
mov ah,2h
int 16h
and ax,4h
mov r,ax
}
return !!r;
}
void setvideomode(char mode)
{
asm{
mov ah,0
mov al,mode
int 10h
}
}
int shiftstatus(void)
{
int r;
asm{
mov ah,12h
int 16h
mov r,ax
}
return r;
}
void setpixel(int x,int y,int c)
{
asm{
mov ah,0ch
mov al,byte ptr c
mov bh,0
mov cx,x
mov dx,y
int 10h
}
}
void setcurpos(int x,int y)
{
asm{
mov ah,2
mov bh,0
mov dh,byte ptr y
mov dl,byte ptr x
int 10h
}
}
void putchar(char c,int col)
{
asm{
mov ah,0eh
mov al,c
mov bl,byte ptr col
int 10h
}
}
void textout(char *txt,int col)
{
for(;*txt;txt++)
putchar(*txt,col);
}
waitkey(void)
{
int r;
asm{
mov ah,10h
int 16h
mov r,ax
}
return r;
}
void showmouse(void)
{
asm{
mov ax,1
int 33h
}
}
void hidemouse(void)
{
asm{
mov ax,2
int 33h
}
}
int ismousepressed()
{
int r;
asm{
mov ax,3
int 33h
and bx,1
mov r,bx
}
return r;
}
int getmousex()
{
int r;
asm{
mov ax,3
int 33h
mov r,cx
}
return r;
}
int getmousey()
{
int r;
asm{
mov ax,3
int 33h
mov r,dx
}
return r;
}
int kbhit()
{
int r;
asm{
mov ah,11h
int 16h
jz nokeys
mov r,1
jmp kbex
}
nokeys:
r=0;
kbex:
return r;
}
while(k!=0x1000);
setvideomode(0x12);
asm{
mov ax,1007h
mov bl,byte ptr bg
int 10h
mov ax,1000h
mov bl,0
int 10h
}
Приветствую! Нуждаюсь в описании асемблерных вставок. Желателен комментарий каждой строчки
[code]
int isrctrl()
{
int r;
asm{
mov ah,2h
int 16h
and ax,4h
mov r,ax
}
return !!r;
}
void setvideomode(char mode)
{
asm{
mov ah,0
mov al,mode
int 10h
}
}
int shiftstatus(void)
{
int r;
asm{
mov ah,12h
int 16h
mov r,ax
}
return r;
}
void setpixel(int x,int y,int c)
{
asm{
mov ah,0ch
mov al,byte ptr c
mov bh,0
mov cx,x
mov dx,y
int 10h
}
}
void setcurpos(int x,int y)
{
asm{
mov ah,2
mov bh,0
mov dh,byte ptr y
mov dl,byte ptr x
int 10h
}
}
void putchar(char c,int col)
{
asm{
mov ah,0eh
mov al,c
mov bl,byte ptr col
int 10h
}
}
void textout(char *txt,int col)
{
for(;*txt;txt++)
putchar(*txt,col);
}
waitkey(void)
{
int r;
asm{
mov ah,10h
int 16h
mov r,ax
}
return r;
}
void showmouse(void)
{
asm{
mov ax,1
int 33h
}
}
void hidemouse(void)
{
asm{
mov ax,2
int 33h
}
}
int ismousepressed()
{
int r;
asm{
mov ax,3
int 33h
and bx,1
mov r,bx
}
return r;
}
int getmousex()
{
int r;
asm{
mov ax,3
int 33h
mov r,cx
}
return r;
}
int getmousey()
{
int r;
asm{
mov ax,3
int 33h
mov r,dx
}
return r;
}
int kbhit()
{
int r;
asm{
mov ah,11h
int 16h
jz nokeys
mov r,1
jmp kbex
}
nokeys:
r=0;
kbex:
return r;
}
while(k!=0x1000);
setvideomode(0x12);
asm{
mov ax,1007h
mov bl,byte ptr bg
int 10h
mov ax,1000h
mov bl,0
int 10h
}
[/code]