15 November 2020, 17:33 | #1 |
A1200 040 SAM440EP 667
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
|
AmiBlitz copy memory to file
Hello,
I tried to copy some bytes in memory to a file in disk with the blitz basic code: Code:
r=OpenFile(0,"Ram:Text") WriteMem 0,FAddress.l,FLength.l ;copy to file 0 a memory block from FAddress with the FLength r=WriteFile (0,"Ram:Text") : CloseFile 0 ;copy file 0 to file Ram:Text FreeMem_ FAddress,FLength ; clean memory Any help in this is welcome because there are very few examples of WriteMem/ReadMem in the net. |
15 November 2020, 18:00 | #2 |
Registered User
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
|
Snipppet from Banshee tile map ripper. Open is not needed. Switch order of two Write commands. See if FileOutput 0 helps.
Code:
AMIGA DefaultOutput NPrint "saving ",Par$(1),".iff " SaveBitmap 0,Par$(1)+".iff",0 NPrint "saving ",Par$(1),".map" l.l=WriteFile(0,Par$(1)+".map") FileOutput 0 WriteMem 0,ma,sz CloseFile 0 End Last edited by clenched; 15 November 2020 at 18:19. |
15 November 2020, 21:18 | #3 |
A1200 040 SAM440EP 667
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
|
Thanks for your help clenched
already understood the dynamic of Read/Write from memory to file: first we need to open the file with WriteFile() then we read the block of memory with WriteMem Code:
If WriteFile(0,"Ram:Text") WriteMem 0,FAddress.l,FLength.l NPrint "File Writed" CloseFile 0 EndIf |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Easy way to copy a file? | AGS | Coders. System | 52 | 16 August 2014 23:10 |
C++ to Assembler conversion (speedup) memory copy hack | NovaCoder | Coders. General | 35 | 09 February 2010 20:37 |
Copy CF card file to ram:, insert other CF card, copy over? | Photon | support.Hardware | 16 | 21 July 2009 22:05 |
Very slow file copy? | DDNI | support.WinUAE | 4 | 16 March 2009 22:16 |
DMA memory to memory copy | BlueAchenar | Coders. General | 14 | 22 January 2009 23:29 |
|
|