Date: 2002-07-17 01:37:10
>> UvB> Currently not, because ".align 2" requires the binary to get also aligned on >> UvB> an even start address. >Ok, maybe you can teach me something:-) How do you think, .align could be >implemented in the assembler, if the start address of the binary is arbitrary >and unknown at assembly time? OMG, there's no working align?? I need that to do some libraries in the future. It seems to be quite simple to solve, take on a very small part of the linkers job - now I don't know much about the linker, but I assume the start address merely depending on the configuration/startup file for the target. Thus give the assembler a "-t" command switch, which can then read the start address ahead of linking, and assemble to that address, then check for alignment. If the alignment fails, just insert padding.. such as ".byte 0" before the data that has to be aligned. Then reassemble and you are done. Of course, instead of changing the source which is not very clean, just do the same thing internally. I will need page alignment to get some code working with large tables. And for speed, staying within a page boundary is good. A simple scheme like padding could waste space, it is up to the programmer to use it effectively. If you could align one table to the start of a page, you should also put other small tables after it, so all of them will also be within one page. Otherwise, the tables would all start on new pages, with some possible wasted space between them. Another solution: put it in the linker. The file format output by the assembler would have to be changed, to state the alignment for a label. I assume that other labels already have an offset. Ie readtable: lda sqrtable,y .align page sqrtable $00,$01,$02,$04 Assembler output file contains some sort of encoding of the following info: readtable=origin+$000 reference to sqrtable=$0001 word expr=sqrtable sqrtable=origin+$003 alignment=page The references to the table would have to be evaluated in the same way the assembler does, and the base address would be decided in a second pass, after all the code and other data has found stable baseaddresses. So in the second pass now you know the next free page boundary is say $900, so sqrtable=$900, and evaluate the expression "sqrtable" to $900 (it could have been ">sqrtable" which would = $09 or some other expression) then stuff that word argument into offset+$0001=$801. So it's a lot harder because you need -expression evaluation code from the assembler -change in assembler output format obviously the first option is quick and dirty hack.. and one more problem, if it were possible to expression evaluation to rely on many other address calculations it would just get very complicated. How indirect can an address calculation be? And what about program maintence, keeping two semi assmeblers in sync? A third option is to simply break out a part of the assembler into a separate address calculator, so no address calculation at all is done in the assembler, and that is left to another linker/address calculator tool, which does make a lot of sense if you think about it. thus the linker would Communicate in total privacy. Get your free encrypted email at https://www.hushmail.com/?l=2 Looking for a good deal on a domain name? http://www.hush.com/partners/offers.cgi?id=domainpeople ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2002-07-17 01:37:29 CEST