TGB1718 Posted November 23, 2021 Author Share Posted November 23, 2021 Been trying out @ilmenit code and configs, it does seem to make a window at the correct area because it now compiles with an error that says lowcode reaches into the window starting at $4000:- D:\ATR_NEW\cc65\MyProjects\Disasembler>ld65 -Ln disassem.lbl --mapfile disassem.map --dbgfile disassem.dbg -C disassem.cfg -o disassem.xex disassembler.o dis.o atari.lib link.o ld65: Warning: disassem.cfg(20): Segment 'LOWCODE' overflows memory area 'RAM_LOW' by 898 bytes ld65: Warning: atari/crt0.s(207): 'lowcode area' reaches into $4000..$7FFF bank memory window ld65: Error: Cannot generate most of the files due to memory area overflow Compilation error the map file shows :- Segment list: ------------- Name Start End Size Align ---------------------------------------------------- AUTOSTRT 000000 000005 000006 00001 FILEHDR 000000 000001 000002 00001 FIRSTHDR 000000 000003 000004 00001 SECONDHDR 000000 000003 000004 00001 ZEROPAGE 000082 00009B 00001A 00001 EXTZP 00009C 0000A0 000005 00001 STARTUP 002000 002062 000063 00001 ONCE 002063 0020BD 00005B 00001 LOWDATA 0020BE 003210 001153 00001 LOWRODATA 003211 003511 000301 00001 LOWCODE 003512 004381 000E70 00001 LOWBSS 004382 004462 0000E1 00001 CODE 008000 0095AB 0015AC 00001 DATA 0095AC 009639 00008E 00001 RODATA 00963A 00971D 0000E4 00001 BSS 00971E 0097B0 000093 00001 Quote Link to comment Share on other sites More sharing options...
sanny Posted November 23, 2021 Share Posted November 23, 2021 Sigh. Could you give the complete source code, and not just the error messages? Like @ilmenit did? My guess is that you've put "too much" into RAM_LOW. For example LOWDATA is quite large. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted November 23, 2021 Share Posted November 23, 2021 (edited) Or even an overview of the solution, a native disassembler seems unnecessary, but each to their own. To me you are using memory where your targeted app will be residing? Edited November 23, 2021 by Wrathchild be->me Quote Link to comment Share on other sites More sharing options...
danwinslow Posted November 23, 2021 Share Posted November 23, 2021 That's a pretty clear error message. You are directing 858 more bytes into LOWCODE than it was defined to hold. You might need to put in some segment pragma control in your source code, which is one reason sanny needs to see it. It is a complicated subject, and puts a lot of people off from using CC65, but it is well worth the effort. You do just about anything with the cfg files. 1 Quote Link to comment Share on other sites More sharing options...
ilmenit Posted November 24, 2021 Share Posted November 24, 2021 To simplify the process and avoid use of segment #pragmas, in my build .bat above the compilation is split into two set of files, that will go to LOW or HIGH RAM areas. At least for me moving the linking related activities (controlling of where code/data will go) from the source codes (#pragma) to the build process is more convenient. @TGB1718 if you are using my build script then split your disassembler.c or dis.c into smaller files and place some of them into the HIGH memory chunk (this one, where in my example src/high is) Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted November 24, 2021 Author Share Posted November 24, 2021 @ilmenit I will split the code, it should be fairly easy as there's a large chunk of static data that's used as a lookup table, so instead of using a header file, I'll create the array in a separate .c file and re-try your build code. thanks again Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted November 24, 2021 Share Posted November 24, 2021 I think I can help with the memory overflows just a little. I use an optimization technique called the Cubbyhole technique. It states that you can use unused sections of Low memory, i.e. the sections of the OS's memory unused within your program, for code and data. Simply define the memory areas in the .cfg file, use #pragmas to place code and data in the memory areas and load them in at the beginning of the main() function. I attached an example .cfg file, but you have to supply the code to load the code and data into the memory areas. Sorry. BTW, I just found a bug in the .cfg file: the PRNBUF_ memory area is defined twice. Disable one of them. atarixl_small.cfg Quote Link to comment Share on other sites More sharing options...
ilmenit Posted November 24, 2021 Share Posted November 24, 2021 8 minutes ago, Harry Potter said: I think I can help with the memory overflows just a little. I use an optimization technique called the Cubbyhole technique. It states that you can use unused sections of Low memory, i.e. the sections of the OS's memory unused within your program, for code and data. Simply define the memory areas in the .cfg file, use #pragmas to place code and data in the memory areas and load them in at the beginning of the main() function. I highly recommend to NOT use it. It will work only on specific OSes of specific versions, while there are differences among different Atari machines. Many users use also modified OSes or OS replacements like QMEG or Altirra OS (now default in Altirra and I think also Atari 800 emulators). Saving $28 bytes (like printer buffer PRNBUF) for losing compatibility of your software with that many configurations is not worth it. Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted November 25, 2021 Author Share Posted November 25, 2021 @ilmenit Had a go at using a modified version of your script, the segments look good and 4000-8000 are free unfortunately the program doesn't run, I just get a black screen, will play with it a bit more and see if I can find out what wrong it does compile and link without errors Segment list: ------------- Name Start End Size Align ---------------------------------------------------- AUTOSTRT 000000 000005 000006 00001 FILEHDR 000000 000001 000002 00001 FIRSTHDR 000000 000003 000004 00001 SECONDHDR 000000 000003 000004 00001 ZEROPAGE 000082 00009B 00001A 00001 EXTZP 00009C 0000A0 000005 00001 STARTUP 002000 002062 000063 00001 ONCE 002063 0020BD 00005B 00001 LOWDATA 0020BE 0020BF 000002 00001 LOWRODATA 0020C0 0023C0 000301 00001 LOWCODE 0023C1 00323E 000E7E 00001 LOWBSS 00323F 00331F 0000E1 00001 CODE 008000 0095E2 0015E3 00001 DATA 0095E3 00A7C1 0011DF 00001 RODATA 00A7C2 00A8A5 0000E4 00001 BSS 00A8A6 00A938 000093 00001 Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted November 25, 2021 Share Posted November 25, 2021 (edited) Load it in Altirra with the debugger open and see what it tells you about the loading and launching. Edited November 25, 2021 by Wrathchild Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted November 25, 2021 Author Share Posted November 25, 2021 Not figured out how to use Altirra's debugger, doesn't seem to want to play for me. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted November 25, 2021 Share Posted November 25, 2021 You don't need to 'use' it, just enable it and then load your binary as normal Quote Link to comment Share on other sites More sharing options...
sanny Posted November 26, 2021 Share Posted November 26, 2021 Is BASIC turned off? Quote Link to comment Share on other sites More sharing options...
ilmenit Posted November 26, 2021 Share Posted November 26, 2021 (edited) 8 hours ago, TGB1718 said: @ilmenit Had a go at using a modified version of your script, the segments look good and 4000-8000 are free unfortunately the program doesn't run, I just get a black screen, will play with it a bit more and see if I can find out what wrong it does compile and link without errors You may need to set proper __STACKSIZE__ and __RESERVED_MEMORY__ Post the created xex here, please. Edited November 26, 2021 by ilmenit Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted November 26, 2021 Author Share Posted November 26, 2021 (edited) Here's the .xex , it looks like the call to _graphics(0) is the problem, if I comment out the call I get the screen although it still had the text from SDX displayed. I created a call to open the screen directly from an asm module using CIOV using code I know works from another project and I get the same black screen. I added a __REDSEVED__MEMORY__ of 1K but still black screen was just about to change the stack size but strangely it's throwing errors during the compile I removed all the changes, (which had nothing to do with the errors now showing) as I've not changed anything in the link.asm, but the linker is throwing these errors ??? *********EDIT******** It's ok, my bad, changed the config file in an attemt to fix the problem, put the correct one back D:\ATR_NEW\cc65\MyProjects\Disasembler>ld65 -Ln disassem.lbl --mapfile disassem.map --dbgfile disassem.dbg -C disassem.cfg -o disassem.xex dis.o disassembler.o structs.o atari.lib link.o Unresolved external '__FIRST_END_LOAD__' referenced in: link.asm(14) Unresolved external '__FIRST_START_LOAD__' referenced in: link.asm(13) Unresolved external '__SECOND_END_LOAD__' referenced in: link.asm(18) Unresolved external '__SECOND_START_LOAD__' referenced in: link.asm(17) ld65: Error: 4 unresolved external(s) found - cannot create output file disassem.xex Edited November 26, 2021 by TGB1718 Quote Link to comment Share on other sites More sharing options...
ilmenit Posted November 26, 2021 Share Posted November 26, 2021 20 minutes ago, TGB1718 said: Here's the .xex , it looks like the call to _graphics(0) is the problem, if I comment out the call I get the screen although it still had the text from SDX displayed. I created a call to open the screen directly from an asm module using CIOV using code I know works from another project and I get the same black screen. I added a __REDSEVED__MEMORY__ of 1K but still black screen disassem.xex 14.74 kB · 1 download https://cc65.github.io/doc/atari.html#ss6.1 - for _graphics(0) it just 1 should be enough according to documentation __REDSEVED__MEMORY__ = 1 Do not open screen by CIOV, because it would require memory space for it and it may not work with how program memory is organized https://cc65.github.io/doc/atari.html#s3 Sorry, no idea what can be wrong with the errors now - they makes no sense as long as you have these in the .cfg file and in the link.asm. Can you attach the whole project? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted November 26, 2021 Author Share Posted November 26, 2021 (edited) @ilmenit Sorry, just edited the last post, my bad, had the wrong config file ? Just going to try the RESERVED MEMORY option UPDATE*** How strange, RESERVED MEMORY set to 1 and it worked, if I left it to the default of 0 it didn't Thank you very much for your help, now to see if I can use that free memory block Edited November 26, 2021 by TGB1718 2 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.