Jump to content
IGNORED

Why won't Low Memory work on cc65 program?


Recommended Posts

Over the decades that I have been involved with Atari 8-bits, I've watched some folks look to higher level languages (like C or Pascal) for something faster than BASIC but easier to learn than 6502 assembly language.  What ends up happening is that, outside of simple console I/O programs (which could be written on any computer) those languages do little to make programming our 8-bit Ataris any easier.

 

With such limited resources, programming a 64K computer requires a thorough understanding of its memory map and what that means in terms of the computer's underlying hardware.  If you find these details too cumbersome, BASIC is truly the best, most approachable way to program these machines.  When you get more comfortable with that, you can branch out into programming small, assembly language subroutines that can be used to speed up your BASIC program.

 

What I am reading in your threads is that you do not understand how the computer's memory map works, and therefore you struggle to properly configure the C linker.  Unless you really understand the layout of your program in memory, you will continually struggle to make C do what you want on these machines.  I assume you are attempting to program the 8-bit Atari because you want to take advantage of its graphics and sounds capabilities, but doing so will be very difficult in this language I believe you have chosen specifically because you think it will be easier (spoiler: it is not easier). 

 

If Atari 8-bit sounds an graphics are what you seek, I recommend getting started in BASIC and then moving to assembly language.

Link to comment
Share on other sites

I have the Mapping the Atari e-book and perused it for usable Low Memory addresses.  I don't need these areas, but using them should increase the amount of usable RAM.  I don't know why my program is not working, but the CBM versions work.  I really don't want to add code to the main module to load in the Low Memory stubs, as the OS should be able to load these stubs into memory from the executable.  You're right about using BASIC first, though, but I have nothing but MadLibAtari to program in BASIC, and MadLibAtari works fine in cc65 C.

Link to comment
Share on other sites

30 minutes ago, Harry Potter said:

I don't know why my program is not working

It's been explained quite a few times now and you need to a) comprehend why and b) resolve.

We can do this for you but my fear it you won't learn unless you work it out.

 

Its not clear whether you have two things going on here... is your library supposed to use the low memory area or is your library something a client (e.g. your test app) is utilising as a kind-of 'framework' and as a bonus they can (optionally) access low memory if they so wish?

 

Edited by Wrathchild
Link to comment
Share on other sites

54 minutes ago, Harry Potter said:

I don't know why my program is not working

But I do:

 

obraz.thumb.png.4ff5fcfcb8865c23fdeddbdecef0141f.png

 

IT OVERWRITES DOS.

 

56 minutes ago, Harry Potter said:

I have the Mapping the Atari e-book and perused it for usable Low Memory addresses.

The addresses listed there for the area $0700-$1FFF are only valid for DOS 2.0s, which means that they are not "contractual", as they say. But even for DOS 2.0s, as it was already said to you, Mapping the Atari gets the address $15A4 wrong: it is not a procedure of "loading MEM.SAV if it exists". It is the binary loader.

  • Like 3
  • Haha 1
Link to comment
Share on other sites

15 minutes ago, Harry Potter said:

It's not the library that is to access the memory but the config files used by the library. 

The config file merely defines the area, it doesn't access it, nor provide any content for it?!

16 minutes ago, Harry Potter said:

I really want to add these memory locations to usable memory.

Then just leave that up to the user, they will know what memory area can be used.

e.g. if the user knows that DOS isn't needed after the XEX has been loaded then they can use that area for what they like.

The user has many options on doing that, decompress data into it or wipe it and use for screen RAM, their call.

Link to comment
Share on other sites

17 minutes ago, Harry Potter said:

Okay.  :(  What parts of Low Memory can I use?

You can use a few bits and pieces here and there, but it's generally not worth it as a utility library for general programming. You can use anything that isn't used by the DOS....and you can figure out where DOS stops by using some memory values. You need to READ mapping the atari and de re atari, not just peruse them. You don't need to write us a utility to use low memory, we all pretty much know what is there and can use it if we feel like it. There really is no magical piece of low memory that you can make useful to anybody in the general case, there are way too many failure cases.

 

  • Like 4
Link to comment
Share on other sites

Hi!

On 10/7/2021 at 2:18 PM, drac030 said:

Maybe providing some switch or even a template to the linker could help it to detect errors in configuration, just as a sort of safety checks. Then you could say to the OP: "add --std-executable to the linker switches and see what it says". This would stop the whole process at the stage where the executable cannot be created, and not at the stage when it is executed and crashes the system.

 

If you use the XEX output format in the linker, it will automatically write correct headers, but he is using the RAW output format, in which the linker does not know the output format. We already told him to use the XEX output format a while ago, also we told him to read the documentation, and we also told him that he does not need to use a non-standard linker config for using low memory, but he does not listen.

 

On 10/7/2021 at 2:18 PM, drac030 said:

In assemblers you are on your own too, but it actually takes effort to convince an assembler to produce a messed-up binary, as the regular executable is usually the default.

In CC65 it is the same if you use the correct linker config, you need to use raw output format to produce an invalid file.

 

Have Fun!

 

  • Like 1
Link to comment
Share on other sites

I see, so nevermind. Anyway, the binary he posted is messed as it can be seen above, but the first problem is that it overwrites the very code that is loading the program (in DOS 2.0s and 2.5 - under any other DOS it overwrites God knows what) . And the OP seems fixated at the idea that what is there "shouldn't be needed by a cc65 program", and is unable to connect the fact that he is overwriting a part of the OS with the fact that his program crashes in the middle of loading. What a mess.

  • Haha 2
Link to comment
Share on other sites

At least part of the issue is that he's using "Mapping the Atari" and much of the stuff in the book that refers to DOS is only relevant to the particular version of Atari DOS that was current at that time.  And of course there are a plethora of DOS's available, and much of the book's info does not apply to any of  them at all...

Link to comment
Share on other sites

On 10/9/2021 at 2:10 PM, Harry Potter said:

I got the message: simply don't do it.  I could be overwriting something important and undocumented.

It isn't undocumented, it just within a number of documents other than the one or another you apparently are reading.

Edited by _The Doctor__
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...