Autor
| save data to disk in assemlby
|
norakomi msx professional Mensajes: 861 | Publicado: Octubre 11 2005, 23:20   |
hola !!!
Id like to make save files within an assemlby program.
Lets say there is 6 bytes data at $c000-$c005, which I want to save to:
savefile.dat
how does this work???
Anyone an example I can use.......??
gracias !!!
|
|
ARTRAG msx master Mensajes: 1802 | Publicado: Octubre 11 2005, 23:43   |
look for the i/o routines in vscreen. The routines you need are
in a nice file well commented and ready to use and can be used
both dos 1 and dos2
|
|
norakomi msx professional Mensajes: 861 | Publicado: Octubre 12 2005, 20:52   |
I never worked with dos,
Could you tell me some more how to do this without dos?
|
|
NYYRIKKI msx master Mensajes: 1533 | Publicado: Octubre 13 2005, 08:35   |
Replace all CALL 5 commands with CALL #F37D
|
|
norakomi msx professional Mensajes: 861 | Publicado: Octubre 13 2005, 16:30   |
What about writing and reading sectors to/from disk....
how does that work?
and when I save a file (in basic for instance)
can I then also choose which sectors the file is saved to???
|
|
AuroraMSX
 msx master Mensajes: 1277 | Publicado: Octubre 14 2005, 14:14   |
Quote:
| What about writing and reading sectors to/from disk....
how does that work?
|
Have a look at the DOS2 docz.
There are BDOS functions to read/write a sector.
Quote:
| and when I save a file (in basic for instance)
can I then also choose which sectors the file is saved to???
|
Ehm, you don't want to mix disk access at sector level and disk access at filesystem level, unless you're willing to (re)write part of the OS. Really.
Of course it is possible:
- read the boot sector and check the media ID byte (or use an other means to locate the FAT
- remember that a double sided disk has 2 (identical) FATs
- read the FAT
- see if the sectors you want to write to are still free
- create FAT and directory entries for your file
- Spill the data on the sectors
- Pray that you didn't make any mistake
But why go through all that trouble? Let BDOS take care of the disk management stuff and just write your data to a regular file.
Besides: directly accessing the disk will definitely make your program unsuitable for hard-disks, CF and/or MMC cards, floppies with other geometry than the one you programmed for etc.
|
|
|
|
|