| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Regs |
G'Day John,
-=> Quoting John Gardeniers to Frank Adam <=-
FA> Just curious why is REGS a union and not a struct ? It feels like
FA> one..
JG> Because the registers come in a variety of sizes REGS has to be
JG> a union. Al & AH are byte wide (CHAR) while AX is the same two but
JG> joined at the hips, therefore it's a word (INT). For those with
JG> something a little more than advanced than my XT there is also a 32
JG> bit version (EAX?). When I was trying to get the hang of this
JG> structure/union thing I found that it all made sense once I saw it
No-no, i've been using regs and unions for some time, but i could never
find any in debt info on *how* they work.
Eg, i access regs.h.ah, and then regs.x.ax. Now according to the manuals
and articles i've seen, i would've thought that the first struct fills up
the union, and the second can't be accessed, but it can.
FA> adress of DTA(Disk Transfer Adress) ?
FA> ptr = (char far*) MK_FP((unsigned)sregs.es,(usigned)regs.x.dx);
JG> The error is in using ES:DX, it should be ES:BX. I just have to
Thanks, will try that.
JG> ask, why do you (or anyone else) use such long winded code?
JG> Whenever I need to do anything at the register level I simply use
JG> in-line assembler code. This is even more important if you are
Because although i can read some assembly , i'm not at all comfortable
writing them.
So my motto is, if in doubt(that's mostly), let the compiler do it. :)
There is also something about it not being ISO, and i believe i've heard
that certain compilers don't support inline asm. (??)
I personally rather look at one of my old code and be able to read it
without thinking much about it. Using the regpacks will do that for me,
Borland's use of _AX,_CX etc. would make it even easier.
With compilers and PCs getting better and faster, the only time i'd
consider asm is if a program truely needs more speed.
L8r Frank (fadam{at}ozemail.com.au).
___ Blue Wave/DOS v2.21
---
* Origin: Melbourne PC User Group BBS (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™.