danwinslow Posted March 8, 2013 Share Posted March 8, 2013 Does anyone have an example of a stand-alone ca65 program startup using the standard atari.cfg ? I took a look at crt0.s but its got a lot of stuff in there that probably isn't necessary and I'd like to get the smallest startup footprint possible. Thanks Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted March 8, 2013 Share Posted March 8, 2013 (edited) Does anyone have an example of a stand-alone ca65 program startup using the standard atari.cfg ? Attached - just changes console color to grey. Build by 'executing' "MakeMain.bat". Since the linker likes to have some symbols, I built my own config. Normally you have to fiddle with the config anyway to fulfil A8's memory constraints for screen, DL, font(s) and PMGs without using the dissipative .ALIGN... MinimalASM.zip Edited March 8, 2013 by Irgendwer 1 Quote Link to comment Share on other sites More sharing options...
danwinslow Posted March 8, 2013 Author Share Posted March 8, 2013 (edited) Thanks so much, Irgendwer. This is perfect. Edited March 8, 2013 by danwinslow Quote Link to comment Share on other sites More sharing options...
danwinslow Posted March 8, 2013 Author Share Posted March 8, 2013 (edited) More questions, if you don't mind. What you gave me seemed to work fine, although it locks up at the end due to the the endless jmp loop you put there. Not sure why you did that, but I assumed I could replace it with a rts and all would be well. So far so good. Then I added some data value, with the code as such to place a 512 byte buffer somewhere: .include "atari.inc" .CODE .proc Main lda #6 sta 710 rts; END: .endproc .SEGMENT "EXEHDR" .word $FFFF .word Main .word Main::END - 1 .segment "AUTOSTRT" .word RUNAD ; defined in atari.h .word RUNAD+1 .word Main .segment "DATA" packetdata: .res 512 This resulted in crashes, so I tried moving it around, etc, and it always seemed to produce some kind of bad effect, either crashes or an 'error 146', which I assume to be a spurious error. So, I'm left with the impression that I don't understand something significant about how to lay out the code. The linker shows the "DATA" segment as part of RAM, which seems to be laid out correctly in the file. What am I not understanding... Edited March 8, 2013 by danwinslow Quote Link to comment Share on other sites More sharing options...
danwinslow Posted March 8, 2013 Author Share Posted March 8, 2013 Well, so in looking at the binary file format...the exehdr would be too short ( END would not have been incremented to include the 512 byte of data... ) and so the loader would have maybe thought the data buffer was actually an INITADR or something. So, if I locate the buffer between proc Main and END: it should work out...and it did. So in this layout I'd have to place all code and data between those two spots? Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted March 8, 2013 Share Posted March 8, 2013 (edited) So in this layout I'd have to place all code and data between those two spots? Yes, or you have to adapt "EXEHDR" end address. Since in this case CODE and DATA are consecutive, this shouldn't be a problem. If not, you have to add an additional data segment file header for the output file too (source and memory config). But if you like to 'reserve' just some data, BSS is better suited since it won't be written to the output file. One of cc65's strongest points, but also highest entry threshold is the memory configuration. It's really the backbone of your output. Edited March 8, 2013 by Irgendwer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.