| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Regs |
-=> On 28 Jun 96 19:39:04 <=-
-=> Frank Adam was heard to tell All <=-
Hi Frank,
FA> Just curious why is REGS a union and not a struct ? It feels like
FA> one..
Because the registers come in a variety of sizes REGS has to be
a union. Al & AH are byte wide (CHAR) while AX is the same two but
joined at the hips, therefore it's a word (INT). For those with
something a little more than advanced than my XT there is also a 32
bit version (EAX?). When I was trying to get the hang of this
structure/union thing I found that it all made sense once I saw it
applied to the registers. Probably a side effect of having been
using assembler for so long.
FA> And can anyone show or guide me to a C snippet,on how to retrieve the
FA> adress of DTA(Disk Transfer Adress) ?
FA> The following should work ( i thought ), but it just boots.
FA> Perhaps the bit between the braces is wrong ? :o)
FA> char* Get_DTA()
FA> {
FA> char far* ptr;
FA> union REGS regs;
FA> struct SREGS sregs;
FA>
FA> regs.x.ax = 0x2f00;
FA> int86x(0x21,®s,®s,&sregs);
FA> ptr = (char far*) MK_FP((unsigned)sregs.es,(usigned)regs.x.dx);
FA> };
The error is in using ES:DX, it should be ES:BX. I just have to
ask, why do you (or anyone else) use such long winded code?
Whenever I need to do anything at the register level I simply use
in-line assembler code. This is even more important if you are
after any kind of speed. For me one of the most powerful features
of C is the ability to easily create hybrid programs, where you have
the convenience of a high level language for easy coding and the
speed of assembler where it's needed.
John
... When the snow melts, where does all the white go?
---
* Origin: Melbourne PC User Group +61-3-9699-6788 (3:632/309)SEEN-BY: 3/103 50/99 620/243 623/630 632/50 107 108 309 348 360 371 504 525 SEEN-BY: 632/530 533 562 633/371 634/388 396 635/301 502 503 506 544 639/252 SEEN-BY: 711/401 409 410 413 430 808 809 932 934 712/515 713/888 714/906 SEEN-BY: 800/1 @PATH: 632/309 107 635/503 50/99 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.