home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,182 of 4,675   
   Bartc to Bernhard Schornak   
   Re: asm improvements?   
   16 Dec 17 22:01:02   
   
   From: bc@nospicedham.freeuk.com   
      
   On 16/12/2017 19:38, Bernhard Schornak wrote:   
   > Bartc wrote:   
   >   
      
   > What about AH, BH, CH, DH?   
      
   They got snipped in the quoting. They're called B16..B19. Just for   
   completeness as they will rarely be used, and ah/bh/ch/dl clash with   
   sil/dil/bpl/spl in that you can't have a register from both groups in   
   the same instruction.   
      
   >>> Why is it preferable to use anything other than the architected   
   >>> register numbers?   
   >>   
   >> Because they're a mess.   
   >   
   > Perhaps they are a mess for you, but they have one big advantage   
   > over your 80 different names for 16 real registers:   
      
   There are 64 names (excluding ah/bh/cx/dx), the same as the official   
   register names. The generic ones are used in software that works with   
   ASM source (reading it or generating it, with the width being an attribute).   
      
   Unlike the official names, these are a simple combination of D/A/W/B and   
   a number from 0 to 15. (Or I could have had R0 to R15 and used a   
   different way to denote width.)   
      
     An assembler   
   > programmer knows them by heart, and the original register naming   
   > is consistent. AL, AH, AX, EAX and RAX are just defined portions   
   > of one and the same 64 bit (or 32 bit until AMD64) register. The   
   > great idea behind that naming gets lost with your new names, and   
   > no other programmer intuitively knows what 'A9' really means. It   
   > could be a macro, label, variable or function, as well... ;)   
      
   Numbered registers seem to used on many machines with multiple registers.   
      
   Looking back a few years, PDP10 used AC0 to AC15. PDP11, R0 to R7. IBM   
   360, R0 to R15. 68K, D0 to D15 and A0 to A15 (including "A9"!).   
      
   Z8000, R0 to R15 for 16-bit registers, with other prefixes when accessed   
   as 8-bit halves, or grouped into 32 or 64 bits.   
      
   PowerPC, R0 to R31. Etc. While ARM processors I've looked at use R0 to R15.   
      
   In fact Intel is probably the exception, but even there, its   
   non-general-purpose registers are numbered: ST0 to ST7, MMX0 to MMX7,   
   XMM0 to XMM15, etc.   
      
   So I don't think there's much wrong with an idea that is widely used   
   elsewhere.   
      
   Going back to Intel names, having a register called "edi" followed by   
   one called "r8d" sounds pretty crazy.   
      
   Anyway, I can use both lots of names.   
      
   --   
   bartc   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca