Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
somebody please explain this code

MIDL
void setpos(int p)      
{
    union REGS regs;
    regs.h.ah = 2;
    regs.h.bh = 0;
    regs.h.dh = 4;
    regs.h.dl = p;
    int86(0x10,&regs,&regs);
}
Posted

1 solution

That's sort of assembly code within a C program. The assignments are to store values in the processor registers and then call interrupt 0x10.
Interrupt 0x10 with the value 2 in register AH means to set the cursor position.
Register BH is the screen page (0 means the visible screen) and registers DH and DL are the x and y coordinates on the screen.

Have a look here[^] for information on interrupts and here[^] for information specifically about interrupt 10.
 
Share this answer
 
v3
Comments
LloydA111 2-Dec-10 18:28pm    
Good answer!
Rajesh R Subramanian 3-Dec-10 1:25am    
Neat! Have my 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900