| |
Rudi Account closed
Registered: May 2010 Posts: 125 |
C64 raw (.prg) and disk files
Hi,
How does raw data from the contents of a disk look like? Now I am talking about the headers not the data content (the actual routines).
I happen to lack a original diskdrive thats why I ask this, and if I was to release something (a tiny intro) at X I have not possibility to test it beforehand here at home. I only have tapedrive to test on real hardware. Im wondering if the two-byte header (the instruction pointer/program counter address) is enough?
Since X organizers load from disk:
I need only the short info, not .d64 content for example. Since this is for very tiny intro. For example 32 byte intro. Because that diskheader (except .prg) does not include size of demo/intro. "No, this is not another Wallflower demo". Another question: Is it enough to transfer a .prg to a disk? or do one need .d64 content like.
Does it happen to be the same for a tape-drive (.t64) the .prg header+data or is it different. I have books, but dont know where to start. Loading hasnt been my priority the last months since i started C64 coding again.
I hope i wasnt too unclear about what i ask for. I'll try and be more clear if wondering what im asking for. It's just that its stupid that i do not have a real diskdrive to test it on :P Also at the same time I am wondering if anyone have an extra diskdrive, for example an 1541-II or preferably an 1541 Ultimate-II to sell me at X?
THanks. |
|
| |
Skate
Registered: Jul 2003 Posts: 494 |
Rudi, i'm not an organizer but the answer is yes, only 2 bytes header (loading address) is same and enough. so, for 32 byte intro, you have 30 free bytes to code.
p.s: i recommend $0326 start address trick. search the forum if you don't know about it. |
| |
Rudi Account closed
Registered: May 2010 Posts: 125 |
AH cool, thanks! |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
An example of $0326 usage, to bypass the need for a basic line that starts the program:
http://codebase64.org/doku.php?id=base:256_bytes_tune_player |
| |
Rudi Account closed
Registered: May 2010 Posts: 125 |
sorry for the delay.
Frantic: yes. im actually using that header.
*=$326
.word $032a, $f6ed
(6 bytes)
there also seem to be a header at:
*=$7c
sei
(3 bytes)
which ive experimented alittle, but sometimes the code needs to be aligned, and some registers wont work the way they are supposed to. |
| |
AlexC
Registered: Jan 2008 Posts: 299 |
Just to clarify few things.
From technical point of view data on the 1541 disk is stored in GCR format, but it has nothing to do with you question about loading address.
Data on tape is stored differently and the format of executable (prg) file is different since you have a header that is loaded first into tape buffer. To check it out enter from BASIC: SYS 63278 and using monitor inspect memory from $033C.
Disk drive is not using tape buffer in memory, instead 1541 has its own RAM divided into buffers.
The $326 will work both from tape and disk - if you don't have access to real 1541 than you can test it out with emulator like Vice and since you are referring to t64 files I assume you use some emulator already. This is so basic trick that any decent c64 emulation will handle it and it will work exactly the same way on real c64+1541, no need to worry about it.
As for registers and memory I'm not sure I fully understand your problem but keep in mind that:
1) registers can be setup differently if you have some kind of turbo loader etc
2) memory content after reset can and will be differente on real c64 than what you get on emulator - do not trust those values
Hopes this helps a bit. |
| |
Fresh
Registered: Jan 2005 Posts: 101 |
You can cut 2 more bytes by using $032c to "automagically" run your code. This routine gets called at the end of the load process to close all channels ($F32F).
It doesn't need to be followed by particular sequences of bytes. |
| |
Rudi Account closed
Registered: May 2010 Posts: 125 |
thanks for the replies.
AlexC: yes, i use Vice already. but also real hardware with a cassette player/recorder. no diskdrive as pointed.
Freshness79: ok. i tried $32c now. it works in memory, but when i want record it to tape it will write over the Tape I/O buffer in $033c to $03fb which will cause it to fail. |
| |
AlexC
Registered: Jan 2008 Posts: 299 |
Rudi, if you are using Vice just test your code on it and than transfer it to the correct media to run on real hardware. I can assure you that none of the autoloading tricks mentioned here will work under emulator but not work under stock c64.
Keep in mind however that playing with vectors and zero page can be tricky if you have some cartridges (most notably turbo loaders/freezers) attached. Again stuff discussed so far should not interfere with any of popular ones. |