Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > C64 raw (.prg) and disk files
2012-10-03 18:41
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.
2012-10-03 18:51
Skate

Registered: Jul 2003
Posts: 491
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.
2012-10-03 18:53
Rudi
Account closed

Registered: May 2010
Posts: 125
AH cool, thanks!
2012-10-04 07:24
Frantic

Registered: Mar 2003
Posts: 1628
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
2012-10-16 14:34
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.
2012-10-16 21:33
AlexC

Registered: Jan 2008
Posts: 293
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.
2012-10-17 13:27
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.
2012-10-19 17:11
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.
2012-10-22 20:49
AlexC

Registered: Jan 2008
Posts: 293
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.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
LMan
Doc Snyder/ONS
Bitbreaker/Performers
controlport2
Guests online: 110
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.05 sec.