curzon@kaoa01.dec.com (09/26/86)
Further to John Sangsters comment on appending binary files, to get them to all run in succession: Joe who posed the question is an old Atari hand, but for others who (like myself) only "know enough to be dangerous", here's some stuff on appending executable files that I took a long time to find. Appending files is a good trick to chain programs together, and it's easy but for one little pitfall. A program may load and run just fine on its own, but fail to run after you append something to the back of it. That's USUALLY because there are two ways DOS will pass control to your program after you load it. First, after it loads any program SEGMENT, it checks location $2E2/$2E3 (DOS init vector). If that location has been changed during that last segment load, it jumps (JSR) to the address placed there (low byte, high byte as usual). When and if it returns (RTS) from that code, it continues to load the next segment of the file, and checks for a change to the init vector again. Then, when end of the whole file is reached (end of all the appended segments) it checks init as above, returns, and then it checks $2E0/$2E1 (DOS run vector). It will JSR to the RUN vector, if changed. The point is if your program is entered by the RUN vector, it can only start up if it's the LAST segment loaded. For example: xm301 handler file HANDLER.OBJ that Atari distributed, is no good if you simply append subsequent files to it. It has a RUN vector segment at the end of the OBJ file, which will then be ignored. To append a terminal program, or BBS program to it you have to change the final segment (at the end of the file) from: $E0 $02 $E1 $02 [addr-lo] [addr-hi] to: $E2 $02 $E3 $02 [addr-lo] [addr-hi] ... which will install [addr] in the INIT location, where it gets acted on. I think most programs will by default use a RUN vector not the INIT. (including Basic compilers, Action). Of course, if a program includes both a DOS init segment, and a DOS run segment, you will have to get fancier. Joe pointed out to me too, that using OSS DOS (and I think SpartaDOS) you can use a batch file to chain programs, rather than appending them. That may be a lot easier... Hope this is useful to somebody out there: I thought it was going to be a 5 lines long but....