English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 13 April 2017, 03:48   #1
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 361
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.
alpine9000 is offline  
AdSense AdSense  
Old 13 April 2017, 07:03   #2
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 43
Posts: 904
Send a message via Yahoo to Samurai_Crow
Have you tried closing the Workbench screen at start-up?
Samurai_Crow is offline  
Old 13 April 2017, 07:57   #3
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 361
Quote:
Originally Posted by Samurai_Crow View Post
Have you tried closing the Workbench screen at start-up?
Is the workbench screen started with an empty startup sequence?
alpine9000 is offline  
Old 13 April 2017, 08:18   #4
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 43
Posts: 904
Send a message via Yahoo to Samurai_Crow
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.
Samurai_Crow is offline  
Old 13 April 2017, 08:39   #5
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 361
Quote:
Originally Posted by Samurai_Crow View Post
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.
Ah great - that's exactly the kind of thing I'm looking for
alpine9000 is offline  
Old 13 April 2017, 10:54   #6
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 361
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 11:08.
alpine9000 is offline  
Old 14 April 2017, 21:55   #7
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,625
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:...
mark_k is online now  
Old 15 April 2017, 01:33   #8
hitchhikr
Registered User

 
Join Date: Jun 2008
Location: somewhere
Posts: 360
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);
}
And the binary: http://franck.charlet.pagesperso-ora...emp/add21k.zip

Last edited by hitchhikr; 15 April 2017 at 01:44.
hitchhikr is offline  
Old 15 April 2017, 10:59   #9
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 361
Quote:
Originally Posted by hitchhikr View Post
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);
}
And the binary: http://franck.charlet.pagesperso-ora...emp/add21k.zip
Thanks, I'll give this a try.

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.
alpine9000 is offline  
Old 15 April 2017, 13:33   #10
hitchhikr
Registered User

 
Join Date: Jun 2008
Location: somewhere
Posts: 360
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
hitchhikr is offline  
Old 27 April 2017, 11:31   #11
Apollo
Registered User

Apollo's Avatar
 
Join Date: Sep 2008
Location: Germany
Age: 43
Posts: 111
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
Apollo is offline  
Old 02 May 2017, 18:23   #12
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 627
@hitchhikr

I checked your add21k and it didn't work under kick1.3. I have seen guru meditation #81000009.00000058.
Asman is offline  
Old 02 May 2017, 20:28   #13
zipper
Registered User
 
Join Date: Mar 2004
Location: finland
Posts: 1,387
That's odd - I think it was on my Lotus 1 disk (yes, confirmed).
zipper is offline  
Old 02 May 2017, 21:15   #14
hitchhikr
Registered User

 
Join Date: Jun 2008
Location: somewhere
Posts: 360
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);
}
The binary:

http://franck.charlet.pagesperso-ora...emp/add21k.zip
hitchhikr is offline  
Old 02 May 2017, 23:35   #15
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 627
@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
Asman is offline  
Old 03 May 2017, 01:24   #16
hitchhikr
Registered User

 
Join Date: Jun 2008
Location: somewhere
Posts: 360
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.
hitchhikr is offline  
Old 07 May 2017, 05:10   #17
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,051
http://eab.abime.net/showthread.php?t=72215
idrougge is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where does all my Chip RAM go? Mrs Beanbag support.Other 25 23 June 2014 14:04
How 2MB chip ram with the Mini Megi Chip? Antti support.Hardware 6 04 June 2014 21:54
A600 multi-upgrade (Chip RAM + Fast RAM + ROM + IDE2CF) Astrofra Hardware pics 15 18 February 2014 22:27
Show free chip ram in Blitz2? Coagulus Coders. Blitz Basic 3 21 September 2012 15:56
[SAS/C] Making malloc() allocate in fast RAM instead of chip RAM? 8bitbubsy Coders. General 3 07 August 2011 08:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:41.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.20295 seconds with 14 queries