13 April 2017, 02:48 | #1 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Maximise free chip ram when booting from a floppy using the OS
I have been down the trackloader route for games and obviously we are in full control of all ram, so I have that covered.
But lately I have been toying with the concept of an OS friendly option that boots from a floppy and still runs in low ram config amigas (Think 512 chip, 512 slow). If I create a boot floppy that only just launches the game from the startup-sequence I noticed the amount of free chip ram is quite different depending on the ROM version. 2.04 seems to give me more free ram than 1.3 for example. I am assuming that if someone has other peripherals attached that might also impact the free chip ram ? Are there any tricks to freeing up this ram before I launch my game ? I notice on 2.04 it doesn't seem to create a console window, but 1.3 does. |
13 April 2017, 06:03 | #2 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
|
Have you tried closing the Workbench screen at start-up?
|
13 April 2017, 06:57 | #3 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
|
13 April 2017, 07:18 | #4 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
|
On Kickstart 1.x it is. I think the original shareware Deluxe PacMan there is a utility in its startup sequence that calls CloseWorkbench() and launches a binary then calls OpenWorkbench() afterwards. It is called free16k or something like that.
|
13 April 2017, 07:39 | #5 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Ah great - that's exactly the kind of thing I'm looking for
|
13 April 2017, 09:54 | #6 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
I found this:
http://amigadev.elowar.com/read/ADCD.../node0576.html Which describes what you have said above. It mentions a commodore utility called "EndRun" that sounds like it is exactly what I am looking for. Anyone got it ? Edit: Found it on the developer CD Last edited by alpine9000; 13 April 2017 at 10:08. |
14 April 2017, 20:55 | #7 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,336
|
In addition to EndRun, you may be able to have code in the bootblock which disables all extra floppy drives. I think you'd just need to open disk.resource and allocate all non-zero units. That will prevent trackdisk.device and DOS from using chip memory for them. Of course you might want to carefully handle the case where the user boots the disk in DF1: not DF0:...
|
15 April 2017, 00:33 | #8 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
The source (to be improved):
Code:
/* * Frees approx 21k of chip memory * (Also speeds up the CLI a bit). * Probably not a good idea to use this on anything * else than a 1.x KickStarts. */ /* * Includes */ #include <libraries/dos.h> #include <exec/types.h> #include <exec/memory.h> #include <intuition/intuitionbase.h> #include <clib/all_protos.h> /* * Variables */ struct IntuitionBase *IntuitionBase; struct DOSBase *DOSBase; struct Screen *scr; struct BitMap *bm; struct Window *win; ULONG orig_height; /* * Program entry point */ int main(int argc, char *argv[]) { PLANEPTR pl0; PLANEPTR pl1; PLANEPTR plb; PLANEPTR ple; IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0); DOSBase = (struct DOSBase *) OpenLibrary("dos.library", 0); scr = IntuitionBase->ActiveScreen; win = IntuitionBase->ActiveWindow; orig_height = scr->Height; SizeWindow(win, 0, 56); Delay(1 * 50); scr->Height = 256; bm = &scr->BitMap; bm->Rows = 256; bm->Depth = 1; pl0 = bm->Planes[0]; pl1 = bm->Planes[1]; bm->Planes[1] = NULL; plb = pl0 + (640 * 256 / 8); ple = pl1 + (640 * orig_height / 8); RemakeDisplay(); FreeMem(plb, ple - plb); CloseLibrary((struct Library *) DOSBase); CloseLibrary((struct Library *) IntuitionBase); return (RETURN_OK); } Last edited by hitchhikr; 15 April 2017 at 00:44. |
15 April 2017, 09:59 | #9 | |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
Today I tried EndRun and while it does close the cli window it doesn't result in me being able to load a larger chip segment. I'm guessing it frees some ram but it must be fragmented and not able to be allocated in one larger chunk. |
|
15 April 2017, 12:33 | #10 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
Perhaps you could make something out of this:
http://aminet.net/package/util/cli/flush220 http://aminet.net/package/util/sys/AllocFrags http://aminet.net/package/util/moni/memm (requires MUI) http://aminet.net/package/dev/c/nofraglib |
27 April 2017, 10:31 | #11 |
Registered User
Join Date: Sep 2008
Location: Germany
Age: 49
Posts: 137
|
I remember that there was a tool (maybe for kick 1.2/1.3) reducing the number of bitplanes of the workbench screen to one and so releasing some kilobytes of valuable chipram.
something like that f.ex. http://aminet.net/package/util/misc/add36k |
02 May 2017, 17:23 | #12 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
@hitchhikr
I checked your add21k and it didn't work under kick1.3. I have seen guru meditation #81000009.00000058. |
02 May 2017, 19:28 | #13 |
Registered User
Join Date: Mar 2004
Location: finland
Posts: 1,838
|
That's odd - I think it was on my Lotus 1 disk (yes, confirmed).
|
02 May 2017, 20:15 | #14 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
Asman: looks like a memory block freed twice.
It works here on v1.2 & v1.3 kickstarts Maybe this one is more compatible ? Code:
/* * Add21k v0.2 * Frees approx 21k of chip memory * (Also speeds up the CLI and the Workbench a bit). * Probably not a good idea to use this on anything * else than a 1.x KickStart. */ /* * Includes */ #include <stdio.h> #include <libraries/dos.h> #include <exec/types.h> #include <exec/memory.h> #include <intuition/intuitionbase.h> #include <clib/all_protos.h> /* * Variables */ struct IntuitionBase *IntuitionBase; struct DOSBase *DOSBase; struct Screen *scr; struct BitMap *bm; ULONG orig_height; ULONG orig_width; /* * Program entry point */ int main(int argc, char *argv[]) { PLANEPTR pl0; PLANEPTR pl1; IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0); DOSBase = (struct DOSBase *) OpenLibrary("dos.library", 0); scr = IntuitionBase->ActiveScreen; orig_width = scr->Width; orig_height = scr->Height; bm = &scr->BitMap; bm->Depth = 1; pl0 = bm->Planes[0]; pl1 = bm->Planes[1]; if(pl1 != NULL) { bm->Planes[1] = NULL; RemakeDisplay(); FreeMem(pl1, (orig_width * orig_height / 8)); } CloseLibrary((struct Library *) DOSBase); CloseLibrary((struct Library *) IntuitionBase); return (RETURN_OK); } http://franck.charlet.pagesperso-ora...emp/add21k.zip |
02 May 2017, 22:35 | #15 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
@hitchhikr
Thanks a lot. Now it works. Frankly few minutes before you posted answer I figured out that. So I recoded it to asm version. Binary and asm version in The Zone. As I checked Avail return 20496 bytes more in column Available. Code:
; ;add21k based on hitchhikr c source of add21k ; ;I tested it only on kickstart 1.3 ; incdir 'includes:' include 'intuition/intuitionbase.i' include 'intuition/screens.i' add21k: ;open intuition library move.l 4.w,a6 lea intuitionName(pc),a1 jsr -408(a6) ;exec OldOpenLibrary move.l d0,d7 beq.b .exit ;calculate one bitplane size (width * height / 8) move.l d0,a0 move.l ib_ActiveScreen(a0),a1 move.w sc_Width(a1),d1 move.w sc_Height(a1),d2 mulu d1,d2 lsr.l #3,d2 ;set screen bitplanes depth lea sc_BitMap(a1),a2 move.b #1,bm_Depth(a2) move.l a0,a6 jsr -384(a6) ;intuition RemakeDisplay ;free second bitplane memory move.l 4.w,a6 move.l 12(a2),a1 move.l d2,d0 jsr -210(a6) ;exec FreeMem ;close intuition library move.l d7,a1 jsr -414(a6) ;exec CloseLibrary moveq #0,d0 .exit rts intuitionName: dc.b 'intuition.library',0 |
03 May 2017, 00:24 | #16 |
Registered User
Join Date: Jun 2008
Location: somewhere else
Posts: 511
|
Another version in C (smaller and doesn't crash if executed several times).
http://franck.charlet.pagesperso-ora...emp/add21k.zip (Source in .zip). I tested it on 3.0 and it works well until a loadwb is issued, there it crashes. |
07 May 2017, 04:10 | #17 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
|
21 April 2020, 13:19 | #18 |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,540
|
I had the exact same problem outlined in this thread, and the thread helped a lot.
My game uses system friendly OS calls to load files, and when booted from Kickstart 1.3, there just wasn't enough memory to boot the game under 512K Chip/512K Other. I needed to use both ENDRUN and CloseWorkbench(). So far as I can tell, ENDRUN by itself closes the CLI while simultaneously opening the target application, but CloseWorkbench() actually frees the memory. CloseWorkbench() won't work if Workbench is still in use (if the CLI is opened) so it's important to use both. 40KB saved! |
21 April 2020, 15:03 | #19 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Hi earok, check this thread, is where my addchip utility was born:
http://eab.abime.net/showthread.php?t=87859 Then the Odyssey+ release: http://eab.abime.net/showpost.php?p=...8&postcount=44 There inside a little utility that I've written that do an advanced EndRUN (multiple file launcher) and CloseWorkbench() in a single exe. (well, it's a custom version, but I can give you the generic version) Odyssey is a game that use OS to load files, originally in two disks and a bit picky about memory configurations. Was very challenging pack it in one disk and make it work in every configuration. So my utility pair was crucial. I'm pretty confident it's impossible to have more memory on a 512+512 machine (and with the larger contiguous block) of that combination . |
21 April 2020, 15:07 | #20 | |
Registered User
Join Date: Dec 2013
Location: Auckland
Posts: 3,540
|
Quote:
Am I allowed to use your utility in my own releases, as well as being part of the (potentially, commercial in future) Scorpion Engine toolkit? |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show free chip ram in Blitz2? | Coagulus | Coders. Blitz Basic | 7 | 23 September 2019 03:53 |
Where does all my Chip RAM go? | Mrs Beanbag | support.Other | 25 | 23 June 2014 13:04 |
How 2MB chip ram with the Mini Megi Chip? | Antti | support.Hardware | 6 | 04 June 2014 20:54 |
A600 multi-upgrade (Chip RAM + Fast RAM + ROM + IDE2CF) | Astrofra | Hardware pics | 15 | 18 February 2014 21:27 |
[SAS/C] Making malloc() allocate in fast RAM instead of chip RAM? | 8bitbubsy | Coders. General | 3 | 07 August 2011 07:06 |
|
|