|
Atari coding BBS
Re: Mxalloc? |
Posted by: evil
|
Aug,29.2013-21:29
|
Hi,
Mxalloc() is not good on ST, it only works from TOS 2 and up, most STs are on TOS 1. Use malloc() instead, that's available on all TOS versions.
Mxalloc() adds some features like reserve from TT-RAM (FastRam in Amiga terms) or ST-RAM (ChipRam). With malloc() it will reserve the kind of memory that is specified in the file header, so a bit less flexible. Oh, one more thing, Mfree() is done automaticly at pterm().
However with that said, if you place your ds.l (it should really be ds.b!) in "section bss" it will not bloat the executable file. Eg:
section bss
screen: ds.b 32000*2+256
As for available free memory; if you start the demo from AUTO-folder you'll lose about 80k from the installed memory. If you launch from desktop another 40k or so will be gone, I'm probably wrong by some magnitude though, the summer heat has caused severe brainrot. The best way to test is really to create a minimal program that makes malloc(-1) and print the return value to see the largest free memory block. If that's too tedious (to write a text displayer) you can just make a .prg with empty buffer and decrease the buffer-size until it works.
And finally, if you want all memory, you can grab all vectors, copy your code to desired low memory address and "jmp" there. The code needs to be assembled for an absolute address then, or relocated in place. Needless to say, there is no recovery back to the OS on a 520. Another way is to have a small sector loader in the BOOT-sector of a floppy that loads your code to a specified memory address and run from there, you'll have access to all memory as well then. Both these methods are harder and will make people with more memory and harddisk a little disapointed that they can't exit back to OS or have to write a fucking floppy disk image. Last time I did that it took nearly 10 disks until I found one that worked, grrr :)
--
Anders Eriksson
ae@dhs.nu
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|