The .START directive not only affects the execution address used by the simulator code, it also influences the address field of an S8 or S9 record when S-record is selected as the object output. In an S-record loader that is “properly designed,” the starting execution address of the loaded program will be established by decoding the address field of the S8 or S9 record that terminated the load. Hence limiting .START to work only with bank $00 would cripple functionality that Mike Kowalski built into the package.
In an S-record loader that is “properly designed,” the starting execution address of the loaded program will be established by decoding the address field of the S8 or S9 record that terminated the load. Hence limiting .START to work only with bank $00 would cripple functionality that Mike Kowalski built into the package.
If we're talking about writing out to a file that tries to impart some additional meaning to the values than a flat binary dump, then .START directive makes perfect sense. E.g. S-Record, or maybe an ELF or other format that might want to provide an OS info on where a program's start function actually is. (Thank you for clearing that up for me BDD)
This point is somewhat muddied inside the code as the assembler doesn't really directly output any of these files. It just writes directly into the simulator memory, and bits of info get lost amongst the sea of things that happens between the assembler completing and (maybe) the user selecting the option to save the code.
Also had it in my head for some reason that the start address was settable directly from the UI. Seems that's only the case from the load code options. (Of which I have not fully finished those or worked out all the details of their needs in the port.)
This program is not just an assembler however. It's more of an IDE that includes assembler and simulator.
Actually kind of my point really. As the program is all of these things, it makes it all the more important that the assembler (and other parts) maintain as little access to each other as reasonably possible.
The assembler really should be agnostic to the idea that it's making stuff for the simulator. As such, it's output would be more likely to work on actual hardware, not just in the confines of the simulator.
One of my goals is to move the assembler portion into it's own standalone command line interface, with the intention of being able to use it inside of a build script, or as I believe BDD noted, could be run from any editor the user so chooses. If the .START just updated the UI's idea of the start address; then that kind of defeats the point of it continuing to be there. However, I see now how that can be handy for the reasons that BBD just pointed out.
The simulator really shouldn't be making any assumptions that the code was generated by it's own assembler. If you load up a raw binary generated by the CA65, WLA-DX, or whatever else, it should work (obviously baring the lack of other support hardware those binaries might be looking for e.g. a 6522).
Additionally (and the simulator portion is REALLY bad about this, as this is the #1 thing that is giving me heart burn with the port), the simulator shouldn't be making direct access to the UI. (The MFC version loves sending raw Win32 messages itself, and has hard references directly to the UI classes).
As for the .START in of itself, it does look like the assembler does not just reach into the UI and adjust it's idea of what that value should be. (Yeay!) It is the UI that asks for the assembler for the result of that, and doing what it needs to with it. (This is good, and as I would expect it to be.)
THAT being all said and done. If you still want to be able to support .START from any location in memory; I think you're looking at possibly more than just trying to work out what the E flag is doing. Code in that area is almost certainly going to be expecting various other things to be initialized. (E.g. the stack pointer, the various bank registers, etc.)
[ OKAY, rambled on long enough... time for me to sleep..... x_x ]