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,176 of 4,675   
   Bartc to wolfgang kern   
   Re: asm improvements?   
   16 Dec 17 15:05:42   
   
   From: bc@nospicedham.freeuk.com   
      
   On 27/08/2017 09:49, wolfgang kern wrote:   
      
   > [...about register names]   
   >   
   > you are free to decide and may rename all registers after girls,   
   > but I heavy daubt that this make your source better readable.   
      
   I've used alternate names via macros using Nasm.   
      
   I'm also in the middle of writing an x64 assembler designed for working   
   with the output of code generators, and there I use a similar scheme.   
      
   Here's why: the names in my scheme are completely consistent, unlike the   
   Intel-style 'official' register names shown in brackets:   
      
      
   64-bit        32-bit        16-bit        8-bit         Generic   
      
   D0  (rax)     A0  (eax)     W0  (ax)      B0  (al)      R0   
   D1  (rbx      A1  (ebx)     W1  (bx)      B1  (bl)      R1   
   D2  (rsi)     A2  (esi)     W2  (si)      B2  (sil)     R2   
   D3  (rdi)     A3  (edi)     W3  (di)      B3  (dil)     R3   
   D4  (r10)     A4  (r10d)    W4  (r10w)    B4  (r10l)    R4   
   D5  (r11)     A5  (r11d)    W5  (r11w)    B5  (r11l)    R5   
   D6  (r12)     A6  (r12d)    W6  (r12w)    B6  (r12l)    R6   
   D7  (r13)     A7  (r13d)    W7  (r13w)    B7  (r13l)    R7   
   D8  (r14)     A8  (r14d)    W8  (r14w)    B8  (r14l)    R8   
   D9  (r15)     A9  (r15d)    W9  (r15w)    B9  (r15l)    R9   
   D10 (rcx)     A10 (ecx)     W10 (cx)      B10 (cl)      R10   
   D11 (rdx)     A11 (edx)     W11 (dx)      B11 (dl)      R11   
   D12 (r8)      A12 (r8d)     W12 (r8w)     B12 (r8l)     R12   
   D13 (r9)      A13 (r9d)     W13 (r9w)     B13 (r9l)     R13   
   D14 (rbp)     A14 (ebp)     W14 (bp)      B14 (bpl)     R14   
   D15 (rsp)     A15 (esp)     W15 (sp)      B15 (spl)     R15   
      
                                              B16 (ah)      R16  or: B0H   
                                              B17 (bh)      R17      B1H   
                                              B18 (ch)      R18      B10H   
                                              B19 (dh)      R19      B11H   
      
   This mapping suits the Win64 ABI. It might need tweaking for the   
   Linux-64 ABI so that parameter passing registers are still grouped together.   
      
   It's designed to make it easier to write code, either within a code   
   generator, or as inline code.   
      
      
   (I believe Nasm uses "r8b" rather than "r8l", and I allow that former   
   style in my assembler.)   
      
   --   
   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