Ultimate Amiga

Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Forum => Topic started by: rja4096 on November 22, 2007, 10:51:40 AM

Title: Copying files in amos
Post by: rja4096 on November 22, 2007, 10:51:40 AM
Hi, I'm nearly ready to show you all my driving game, just one thing, how do I get amos to copy some files from code. it must be possible.

Please let me know, thanks, Rick.
Title: Re: Copying files in amos
Post by: rednova on November 22, 2007, 06:53:48 PM
Friend:
I am looking forward to see your game. You need to copy an amos code file? The easy way to do that would be to open/load the code in amos, then 'save as' and save under a different name.
Cheers!!!

rednova
-mobilis in mobile-
Title: Re: Copying files in amos
Post by: rja4096 on November 23, 2007, 07:47:19 AM
Hi, I'm looking forward to seeing my game too!

No, sorry I was not clear, about copying files. What i have is 30 IFF files, an amimation done in Dpaint, which is an amimation of a road moving. I need top copy these from disk to RAM disk. When the program runs it loads these one by one and displays on the screen, then mack to the start. I could create a script and have the CLI copy the files, but would like this all to be done in AMOS if possible.

Thanks, Rick.
Title: Re: Copying files in amos
Post by: Spellcoder on November 23, 2007, 09:37:31 AM
METHOD 1 - use an external copy command
If you're using AMOSPro you could use the Exec instruction (http://amigacoding.com/index.php/AMOSi:Exec).

Exec 'copy oldfile RAM:newfile'

If you use the old AMOS you could use an =Doscall (http://amigacoding.com/indexphp/AMOSi:iDoscall) for the same effect.


METHOD 2 - use an extension
Maybe one of the extensions has a instruction for copying.


METHOD 3 - code your own copy function
Otherwise To do it without the C:Copy file you'd have to open the old and new file
and then load part of the file, save that part, load the next part etc.
This way you don't need an external command or extension.
The reason to do the copying in pieces is to save memory and can halfway stop your program.


edit: fixed links.. apparently the forum software doesn't like me to quote the URL :P
edit (feb 2008): updated the links
Title: Re: Copying files in amos
Post by: SamuraiCrow on November 23, 2007, 09:25:37 PM
Actually you could use RedNova's suggestion (assuming that each frame is a static IFF image):
Code: [Select]
For I=1 to 30
  Load IFF "filename"+Str$(I)
  Save IFF "ram:filename"+Str$(I)
Next I
Title: Re: Copying files in amos
Post by: rednova on November 23, 2007, 09:39:41 PM
Samurai Crow:

hehe thanks for mentioning my name!!! Now i feel really good!!!
cheers!!!

rednova
-mobilis in mobile-
Title: Re: Copying files in amos
Post by: Tarzin on January 16, 2009, 06:14:18 AM
Quote
Exec 'copy oldfile RAM:newfile'
This method is working fine! Thanks for the tip.
I've used it for my AmosPro's french installer.

Quote
If you use the old AMOS you could use an =Doscall for the same effect.
Althought, this link is broken.
Title: Re: Copying files in amos
Post by: SamuraiCrow on January 16, 2009, 10:28:39 PM
Try the link at http://www.amigacoding.com/index.php/AMOSi:Doscall (http://www.amigacoding.com/index.php/AMOSi:Doscall) then.
Title: Re: Copying files in amos
Post by: woody.cool on April 07, 2013, 03:47:44 PM
Sorry to resurrect an old thread, you can copy files thus:

Code: [Select]
Openin 1,src$
l=lof(1)
reserve as work 1,l
close 1
bload src$,1
bsave dest$,start(1) to start(1)+l
erase 1

You can use that to copy ANY file, be it ASCII or binary.
Another option, if you have AMCAF, you'll have the FILE COPY command available to you ;)