What is the purpose of registers

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2006
Posts: 15
Reputation: nuwan243 is an unknown quantity at this point 
Solved Threads: 0
nuwan243 nuwan243 is offline Offline
Newbie Poster

What is the purpose of registers

 
0
  #1
Dec 28th, 2006
09)What is the purposes of register used in c++.in c++ help they are used more examples and they are used memory addresses……How can we find the specific functions of memory addresses used in programming?Ex int() and int86() functions…..

#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>

#define VIDEO 0x10

void movetoxy(int x, int y)
{
union REGS regs;

regs.h.ah=2;
regs.h.dh=y;
regs.h.dl=x;
regs.h.bh=0;
int86(VIDEO,&regs,&regs);
}

void main ( )
{
clrscr();
movetoxy(35,10);
cout<<”Hello”;
getch();
}

at the start defined a constant with 0x10 I ask what is the purpose of that 0x10 what is the purpose of the address?
Is that a memory address? how we get to know about a task of a given memory address as a programmer? is there documentations? Is there where to find these things…?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,648
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1498
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: What is the purpose of registers

 
0
  #2
Dec 28th, 2006
0x10 is an interrupt vector, which is a hard-coded memory address where an interrupt handler begins. This can only be used in old 16-bit MS-DOS programs.

Here are assembly language tutorials. If you want to learn interrupts then you will need to know basic assembly language.


Here is information about int 21 functions

If you google for "dos interrupts" you will find info on other interrupts.
Last edited by Ancient Dragon; Dec 28th, 2006 at 10:33 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,127
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 283
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: What is the purpose of registers

 
0
  #3
Dec 29th, 2006
Originally Posted by Ancient Dragon View Post
0x10 is an interrupt vector, which is a hard-coded memory address where an interrupt handler begins. This can only be used in old 16-bit MS-DOS programs.
An older C/C++ compiler can build these programs even on Windows XP machines. And for the most part they will still work. The Command Line is still DOS-based and emulated the interrupt vectors.

Originally Posted by Ancient Dragon View Post
Here are assembly language tutorials. If you want to learn interrupts then you will need to know basic assembly language.
That's not quite true. You don't really need to know assembler as long as you know how to access the REGS structure. It's all taken care of for you.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,648
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1498
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: What is the purpose of registers

 
0
  #4
Dec 29th, 2006
Originally Posted by WaltP View Post
An older C/C++ compiler can build these programs even on Windows XP machines
That is not what I said. I said those interrupts can only be used in 16-bit MS-DOS programs, which requires a 16-bit compiler. The interrupts can not be used if the program is built with any 32 or 64 bit compiler targeted for either MS-Windows or *nix.

Originally Posted by WaltP View Post
That's not quite true. You don't really need to know assembler as long as you know how to access the REGS structure. It's all taken care of for you.
Well, tell me how anyone can now how to populate the REGS structure if he knows absolutely nothing about assembly language??? True he doesn't need to know about many assembler instructions, but he does need to know a lot about the interrupts he is attempting to access.
Last edited by Ancient Dragon; Dec 29th, 2006 at 11:12 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 1700 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC