English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 17 September 2012, 12:35   #1
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 471
Listing files, loading files and allocating all available chip ram.

Hi Guys. I need to do the following..

1. Allocate the largest available chunk of chip ram (largest continuous block)
2. List all files (preferablly starting with mod.) in the EXE folder
3. Load a file
4. Deallocate that block of chip ram (just to be nice)


All calls using dos library etc.

PMC gave me a Doc which shows example assembly calls to these functions but I've since lost it.

Also, the system will be shut down, however I seem to remember Stinger saying that as long as the ports and timers are still on, loading from the hard drive should still be possible?

Any help would be greatly appreciated.

Cheers
h0ffman is offline  
Old 17 September 2012, 14:56   #2
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 988
what do you mean by "the system will be shut down" ? using forbid/permit? if so, that will be void, because using dos library open/read/etc will re-enable multitasking..

If I were you, I would take over the display, but leave multitasking on and raise the priority of your task to avoid anybody else stealing cpu.. that way there will be no problems with listing/loading files.

also, don't allocate more chipram than you actually need.. the crude way to find the largest chunk is to traverse the chipram free list (I don't remember if there is an exec function that will perform this sort of thing).
hooverphonique is offline  
Old 17 September 2012, 16:37   #3
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,239
Quote:
Originally Posted by h0ffman View Post
Hi Guys. I need to do the following..

1. Allocate the largest available chunk of chip ram (largest continuous block)
2. List all files (preferablly starting with mod.) in the EXE folder
3. Load a file
4. Deallocate that block of chip ram (just to be nice)


All calls using dos library etc.

PMC gave me a Doc which shows example assembly calls to these functions but I've since lost it.

Also, the system will be shut down, however I seem to remember Stinger saying that as long as the ports and timers are still on, loading from the hard drive should still be possible?

Any help would be greatly appreciated.

Cheers
1. Use Exec's AvailMem() with MEMF_LARGEST parameter and then use the result of that for AllocMem().
2. Lock the directory and use Examine() (dos.library), then use the info in the FIB (file info block). Then use ExNext() in a loop to examine the next entry, if you get NO_MORE_FILES as return code you have checked all files in the directory. If you need more help let me know, I do have code which does exactly what I just described (needed it for an IFF to chunky converter some years ago).
3. Re-enable ports/timer interrupts and you can happily load a file, I did that in countless demos. And yes, it was me who told you that.
4. Should be obvious.

Quote:
Originally Posted by hooverphonique View Post
If I were you, I would take over the display, but leave multitasking on and raise the priority of your task to avoid anybody else stealing cpu.. that way there will be no problems with listing/loading files.
I actually never liked the "set task priority very high" approach, IMHO demos should kill the system and re-enable it when they need parts of it. Guess it's a matter of taste.
StingRay is offline  
Old 17 September 2012, 18:34   #4
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 988
Quote:
Originally Posted by StingRay View Post
I actually never liked the "set task priority very high" approach, IMHO demos should kill the system and re-enable it when they need parts of it. Guess it's a matter of taste.
Hehe.. Well, if you know exactly what you are doing, that will be fine.. OP suggested that a simple approach might be best

btw, does loading from harddrive not require interrupts (or is that covered by what you call "ports") ? I seem to remember that at least A4000 internal IDE uses INT6..
hooverphonique is offline  
Old 18 September 2012, 01:46   #5
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 471
Cheers Stinger, between you and PMC, the ProTracker DJ Player will become a reality sooner rather than later, even if its a dirty bangs on the chips while reaching around the OS old school style app!
h0ffman is offline  
Old 18 September 2012, 21:43   #6
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 471
Ok, after basically copying some code, I've managed to build a file lister, mem allocator and loader.

However, for some reason, now when I run the file lister, the file info block seems to be missing the first two bytes?! Its really odd, first time I ran it, the file name was at offset 8, now its at 6??

Anyone know why this might be???
h0ffman is offline  
Old 18 September 2012, 21:47   #7
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,239
FIB needs to be longword aligned IIRC. So add a CNOP 0,4 in front of your FIB buffer and it should work.

Quote:
Originally Posted by hooverphonique View Post
btw, does loading from harddrive not require interrupts (or is that covered by what you call "ports") ? I seem to remember that at least A4000 internal IDE uses INT6..
Level 2 interrupt (ports/timers) is enough, at least I never needed a level 6 interrupt to load from HD.
StingRay is offline  
Old 19 September 2012, 00:16   #8
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 988
Quote:
Originally Posted by StingRay View Post
Level 2 interrupt (ports/timers) is enough, at least I never needed a level 6 interrupt to load from HD.
Just checked the schematics - you are correct, IDE indeed uses INT2, not 6.

I wonder if any controllers attached directly to accelerator boards interrupts its cpu directly, thereby circumventing paula!?
hooverphonique is offline  
Old 19 September 2012, 01:57   #9
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 471
Cheers stinger, wondered if that might be the case, never use cnop before! Manage to get all the mod. files in the exe folder, allocate the chip ram for the files size and load it! I know not the most complex of tasks but it's one step closer for the PT-1210 MK1 turntable
h0ffman is offline  
Old 16 October 2012, 21:29   #10
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,772
Quote:
Originally Posted by StingRay View Post
FIB needs to be longword aligned IIRC. So add a CNOP 0,4 in front of your FIB buffer and it should work.
FileInfo and DiskInfo must be 8-byte aligned (CNOP 0,8) for reasons unexplained in Libs & Devs and unrelated to CPU model.
Photon is offline  
Old 16 October 2012, 22:27   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 44
Posts: 23,268
Quote:
Originally Posted by Photon View Post
FileInfo and DiskInfo must be 8-byte aligned (CNOP 0,8) for reasons unexplained in Libs & Devs and unrelated to CPU model.
What? Where?
Toni Wilen is offline  
Old 16 October 2012, 22:54   #12
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,239
Quote:
Originally Posted by Photon View Post
FileInfo and DiskInfo must be 8-byte aligned (CNOP 0,8) for reasons unexplained in Libs & Devs and unrelated to CPU model.
Eh?????
StingRay is offline  
Old 17 October 2012, 00:03   #13
Wepl
Moderator
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 690
Since BCPL uses 64 bit per address, SCNR
Wepl is offline  
Old 07 February 2013, 13:08   #14
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 695
Quote:
Originally Posted by StingRay View Post
3. Re-enable ports/timer interrupts and you can happily load a file, I did that in countless demos. And yes, it was me who told you that.
Hi StingRay

Is this method works fine for kick1.3 ?

Edit: Especially I mean about loading files from DF0:

Regards

Last edited by Asman; 07 February 2013 at 18:33. Reason: added Edit
Asman is offline  
Old 08 March 2013, 02:08   #15
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
I re-enable interrupts for loading on Mr Beanbag, works fine from floppy.

Also I recently added directory listing to the special levels menu, I allocate the file info block buffer with exec.AllocMem; seems to work.
Mrs Beanbag is offline  
Old 23 March 2013, 02:33   #16
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,772
Thread moved to Asm.System!
Photon is offline  
Old 04 April 2013, 22:24   #17
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 695
Quote:
Originally Posted by Mrs Beanbag View Post
I re-enable interrupts for loading on Mr Beanbag, works fine from floppy.

Also I recently added directory listing to the special levels menu, I allocate the file info block buffer with exec.AllocMem; seems to work.
Just for information: I forget to add DMAF_DISK into dmacon and loading from floppy under WinUAE worked only if turbo mode was set (Floppy Drive Emulation Speed).
Now loading from floppy, works fine (re-enable PORTS with DMAF_DISK set into dmacon ), but under WinUAE debugger I obtained exception messages (not too many) when I opened file. I'm not sure if this is ok - but files were loaded correctly.

Edit: One more thing on Kick 1.3. If blitter was taken with OwBlitter (graphics.library) then to load file do DissownBlitter (graphics.library).

Last edited by Asman; 07 April 2013 at 20:54.
Asman is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Would loading WWP files directly be possible? MethodGit support.WinUAE 3 17 October 2010 21:26
Allocating Fast RAM as Chip? Fingerlickin_B support.Hardware 22 20 November 2008 23:15
Loading configuration files problem in 1.5.0 trackah123 support.WinUAE 4 29 July 2008 18:12
Loading configuration files Pantzoid support.WinUAE 3 25 June 2007 22:12
IDE HD freezing when loading big files. pbareges support.Hardware 6 29 May 2006 08:12

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 00:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.08651 seconds with 13 queries