News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Shining

Question on save-file using firmware in ASM

Started by Shining, 05:36, 14 June 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shining

Currently I'm saving files using the firmware-routines cas_out_open, cas_out_direct and cas_out_close to disk.
The files, I'm saving, are for a highscore table so the same file is saved from time to time. I've marked the file as a system-file in the catalogue, so that it is not visible when typing cat.


But now, when I overwrite the file using the above functions, the new file is visible and the system makes a .bak-file out of the old-one.


Is there an easy way to:
1: Prevent the .bak-files to be created
2: Save a file as system file (or is there another firmware-routine to set this status to an existing file)


THANKS!
TGS is back

Download my productions at:
cpc.scifinet.org

TFM

Well, I never use firmware, so I don't remember details... But it may helps if you delete the old file before you save the new one. So no BAK file will be there. Also you can save to another user number, so people will not see the file (immediately).


TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Shining

Or perhaps someone has an example to save a file without firmware ?


The only thing I use the firmware for is for saving and loading. So I have to clean up memory, enable fimrware, save or load, disable the firmware and put my stuff back...
TGS is back

Download my productions at:
cpc.scifinet.org

SOS

Quote from: Shining on 19:06, 14 June 16
Or perhaps someone has an example to save a file without firmware ?
It's a little bit dangerous, it will not run on IDE-Solutions like ACMEDOS, ImpDOS and i don't think it will be run on Albireo,...
Lost compatibility, only for a highscore-save?
You can crypt the file and put a checksum on it.

arnoldemu

@Shining: Does this code work?


ld b,end_filename-filename
ld hl,filename
ld de,&c000
call cas_out_open
ld hl,buffer
ld bc,length
ld a,2
call cas_out_direct
call cas_out_close
ret

;; FILE.BIN but with bit 7 set on extension bytes
filename:
defb "FILE."
defb 'B'+&80
defb 'I'+&80
defb 'N'
end_filename:

It sets bit 7 of the extension. This may solve saving the file with system and hidden.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

SOS

In ACMEDOS you will get a "bad filename".

Shining

I was aware that in the catalog entry, the highest bit of the second letter marks the file as hidden/system so your idea was good. Unfortunately it did not work. Interesting was that AMSDOS accepted the patched filename and ignored the highest bit.
TGS is back

Download my productions at:
cpc.scifinet.org

TFM

In this case @SyX could update ACMEDOS to accept the 8. bit set to 1 too. Make it more compatible.  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Shining

I've now changed my approach and put the relevant files to a different user-number. Will be much easier and I finally want to finish the game...
TGS is back

Download my productions at:
cpc.scifinet.org

Powered by SMFPacks Menu Editor Mod