flat assembler
Message board for the users of flat assembler.

Index > Main > Article: "The Art of Picking Intel Registers"

Author
Thread Post new topic Reply to topic
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88 13 Aug 2009, 16:33
http://www.swansontec.com/sregisters.html

Interesting article about x86 registers. Pretty informative. I thought I'd post it here before I forgot it and lost the link.

_________________
My x86 Instruction Reference -- includes SSE, SSE2, SSE3, SSSE3, SSE4 instructions.
Assembly Programmer's Journal
Post 13 Aug 2009, 16:33
View user's profile Send private message Visit poster's website Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder 13 Aug 2009, 16:46
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:46; edited 1 time in total
Post 13 Aug 2009, 16:46
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 13 Aug 2009, 17:09
asmcoder wrote:
registers sohould be named r0...rX
would be better and objective.
Quote:
Using the registers consistently has other advantages besides size optimization. Like using good variable names, using consistent registers makes code more readable. When they are used properly, the registers have meanings almost as clear as the loop counter, i, in higher-level languages. In fact, I occasionally name my variables in C after x86 registers because the register names are so descriptive. With proper register use, x86 assembler can be almost as self-documenting as a high-level language.

_________________
Previously known as The_Grey_Beast
Post 13 Aug 2009, 17:09
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 13 Aug 2009, 17:32
When asmcoder posts something, I wonder if the method he use to generate it is based on something around this: http://www.codinghorror.com/blog/archives/001132.html
Post 13 Aug 2009, 17:32
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 13 Aug 2009, 18:48
LOL, markov chains(when used for text generation) are funny! I ran the first 3 paragraphs(Starting at "Some people have commented that they....") of the site mattst88 posted through this markov text generator, and WOW are some of the results funny!

"In fact, I occasionally name my variables in C after x86 registers because the register names are so descriptive. "
Becomes
"In fact, I occasionally name my variables in higher-level languages." Laughing


Some other funny markov generated text from those paragraphs:

"When they designed the instruction set, they had a high-level language."
"Using the registers have meanings almost as self-documenting as a lost art."
"Unfortunately, this article is an important step on the road to perform."
"In fact, I occasionally name my variables in your code." Laughing Laughing

_________________
----> * <---- My star, won HERE
Post 13 Aug 2009, 18:48
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder 13 Aug 2009, 20:09
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:46; edited 4 times in total
Post 13 Aug 2009, 20:09
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 13 Aug 2009, 20:35
asmcoder wrote:
Quote:
Using the registers consistently has other advantages besides size optimization. Like using good variable names, using consistent registers makes code more readable. When they are used properly, the registers have meanings almost as clear as the loop counter, i, in higher-level languages. In fact, I occasionally name my variables in C after x86 registers because the register names are so descriptive. With proper register use, x86 assembler can be almost as self-documenting as a high-level language.

so you didnt have done anything complex eought.
Good luck in programming graphic render, or massive calcualtions you will need more than 30 loops. Then eax, ebx, e?x wouldnt matter. It will just bring chaos. r1...r100 is best solution. Also x86 shouldnt be register based (eg: division not using eax but i specyfi registers)

And have you done anything complex enough? Actually I'd myself agree completely with the guy that has written this text about the right usage of registers and readability. And if you don't feel it, it simply means you are too much into your own coding style, not caring too much about how other people do the things. I'm not condemning it, because I also like to stick to my own standards evolved over the years, however you can still learn much from the others' code, and some of the standard are really good to borrow from, and not just circumstancial.
Post 13 Aug 2009, 20:35
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 14 Aug 2009, 19:49
Yes I've done graphic rendering, few asm though... and they have so many variables (not v1,v2,v3.... but variable names) that they will probably be on the stack/cache anyway, not registers. Razz
Post 14 Aug 2009, 19:49
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 15 Aug 2009, 08:14
LocoDelAssembly wrote:
When asmcoder posts something, I wonder if the method he use to generate it is based on something around this: http://www.codinghorror.com/blog/archives/001132.html


Laughing

Quote:
The pig go. Go is to the fountain. The pig put foot. Grunt. Foot in what? ketchup. The dove fly. Fly is in sky. The dove drop something. The something on the pig. The pig disgusting. The pig rattle. Rattle with dove. The dove angry. The pig leave. The dove produce. Produce is chicken wing. With wing bark. No Quack.
Post 15 Aug 2009, 08:14
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 16 Aug 2009, 15:46
ROFLMAO
Post 16 Aug 2009, 15:46
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.