Hello, * On Fri, Dec 05, 2014 at 12:10:04AM +0100 silverdr@wfmh.org.pl wrote: > On 2014-12-04 08:05, Baltissen, GJPAA (Ruud) wrote: [.org vs. using ca65's linking options] > Having said all the above - for a project which is anyway "stoned" in > both its size and memory location for good, I don't see anything wrong > in using the .org directive. My guess is that these are the cases, for > which the directive is available in the first place. Using the linker, you gain more flexibility. An example is the floppy ROM code. There were patches, that moved around in different versions of the ROMs. Using .org and doing it linearly, you end up putting the same code (the patches) over and over again in your sources. Another option is to use macros, define them in the beginning to contain the patches, and only use the macros conditionally. Anyway, you loose the flow of the code. Without .org, but using segments, you can use (hypothetical code): .segment "code1" ... some code... lda #0 .segment "basepatch1" jmp patch1 .segment "patch1" patch1: ldx #3 stx $5678 .segment "codeunpatched1" sta $1234 .segment "patch1continue" jmp patch1cont .segment "code2" patch1cont: ... more code ... Now, in the linker file for the unpatched sources, you put in segments "code1", "codeunpatched1", "code2", and discard the other segments. In the linker file for the patched sources, you put in segments "code1", "basepatch1", "code2" in that order, and put segments "patch1", "codeunpatched1", "patch1continue" at the location were it belongs. If "patch1" was moved in the life cycle of the code (for example, in the $c000-$c0ff area in the 1541, and in the $8000-$BFFF area in the 1571), then you can solve this problem completely in the linker config. There is no need to change the sources, nor even to reassemble them. I have not done this extensively yet in the floppy ROMs, but it is clearly on my todo list. Before time went short, I was working on a tool that post-processed the listing files in order to put the real address in the listing files instead of the relocatible, segment-relative addresses that are currently there. People might remember that I asked some questions on this and the inner workings of ca65 in the cc65 mailing list (Uz' version). The benefits of this approach are much bigger on the floppy than they are on the C64. Anyway, if one combines the VIC20 and the C64 sources (as I have done), the benefits are high there, too, as the C64 moved some patches that were present in the VIC20 into the "normal" stream. Unfortunately, as usual, time went short... I find it very surprising how good the VIC20 and the C64 KERNAL much each other. Even for the code for the IEC bus, the differences are almost minimal if you do some good defines to account for the differences. It is much harder to combined the 1571CR and the 1571 sources. Regards, Spiro. -- Spiro R. Trikaliotis http://www.trikaliotis.net/ Message was sent through the cbm-hackers mailing listReceived on 2014-12-13 11:00:03
Archive generated by hypermail 2.2.0.