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,512 of 4,675   
   bart4858@nospicedham.gmail.com to R.Wieser   
   Re: handy data section format (esp for i   
   26 Jul 18 14:53:41   
   
   On Wednesday, 25 July 2018 19:14:01 UTC+1, R.Wieser  wrote:   
   > Firr,   
   >    
   > > problem is i would like to have some syntax for easy defining of data    
   > > there what i invented is something like   
   > >   
   > > DATA my_label:  "akjhaskjh" 13 10 0 33 33 42   
   > > DATA my_label2:  33 33 "dkjsksj" 13 10 "wkjhwjk" 0 33 33 42   
   >    
   > Most assemblers require a datatype indicator between the label (or    
   > nothing! - like happens with a "continuation" of a previous line) and the    
   > data.  Like db, dw, dd and dq.   
   >    
   > my_data: db 'hello world', 0x0A,0x0D   
   >    db 'this is the second line',0x0A,0x0D,'$'   
   >    
   > And as the datatype indicates the size, you do not need to do it for each    
   > seperate value/string on that line.   
   >    
   > (I could also have used 0xA,0xD or 0x00000A,0x00D.  Doesn't look good, but    
   > thats a whole other matter)   
   >    
   > One drawback: Using the above method a line cannot mix multiple data types,    
   > something which would be possible using your method.   In other words, both    
   > methods have their pros and cons. :-)   
      
   This is an assembler; you just have a separate directive per line. A simple   
   way of mixing them is to somehow allow multiple instructions/directives per   
   line. If you use ";" to separate them, then:   
      
     db 10; dw 20; dd 30; dq 40   
      
   defines 15 bytes: 1 byte of 10, 2 containing 20, and the 4 and 8 containing 30   
   and 40. And the latter two can also contain labels. Not that pretty, but not   
   requiring much invention either.   
      
   (My own assembler is mostly for generated code that I will rarely see, so the   
   data is on separate lines. And when I do write it manually, usually that will   
   be inline in some HLL where the data is generally part of the HLL which has a   
   type system to help    
   out. However, inline ASM in the HLL does allow the ";" separator so I can do   
   the above.)   
      
      
   --    
   bart   
      
   --- 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