how to convert a .prg to .t64 ?

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
aitsch
Vic 20 Amateur
Posts: 51
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

how to convert a .prg to .t64 ?

Post by aitsch »

hello from germany,

my current programm uses the ram from $1000-$1dff and in my opinion it sould be loadable from tape.
i've successfully created an .d64-image and stored my program inside. the vic loads it w/o any problems.
when i try to save it after diskloading on tape i got a

"out of memory" message :cry:

i've tried the same with some ram-expansions and also the same process on a C64. no success!!

i found many tools for converting .t64 to .d64 or .prg to .d64 files but nothing for t64 files.

how can i bring my program on tape?

thx
aitsch

p.s.: the program don't touch the tape-buffer!
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: how to convert a .prg to .t64 ?

Post by Mike »

Note *.t64 is just a container format, which includes the "raw" *.prg file(s) with a directory structure. It has no direct correspondence to a format directly handable by real hardware. You probably meant the *.tap format, which encodes the flux changes at the tape head, and which can directly used by emulators, however requires an intermediary stage as *.wav file to be written to tape.
aitsch wrote:when i try to save it after diskloading on tape i got a "out of memory" message :cry:
This happens because you fill all BASIC RAM. When you specify a file name with SAVE or LOAD, BASIC puts a temporary string at the end of BASIC RAM to have it referenced by the KERNAL file routines. As there's no place anymore, you get the error.

When you have loaded the file from disk, with an unexpanded VIC-20, proceed as follows:
  • clear the screen with SHIFT + CLR
  • issue POKE55,250:POKE56,31:CLR
  • do the save, i.e. SAVE "<name>"
This uses the screen as temporary storage for the file name. When you go with the cursor to the bottom-right corner, you'll see the filename (most probably in shifted characters, hold C= + Shift to see what I mean), in white letters on white background.

With POKE55,0:POKE56,30:CLR you revert to the normal RAM configuration for unexpanded VIC-20.

One other thing:

If your program includes a BASIC stub (xxxx SYS xxxx) DO NOT save it from $1000! BASIC programs saved as file do not include the zero byte before the BASIC start, but start with the link pointer (more details here: "Starting addr for .prgs").
User avatar
aitsch
Vic 20 Amateur
Posts: 51
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

Re: how to convert a .prg to .t64 ?

Post by aitsch »

Mike wrote: Sun Mar 15, 2020 12:30 pm Note *.t64 is just a container format, which includes the "raw" *.prg file(s) with a directory structure. It has no direct correspondence to a format directly handable by real hardware. You probably meant the *.tap format, which encodes the flux changes at the tape head, and which can directly used by emulators, however requires an intermediary stage as *.wav file to be written to tape.
...
hm... i agree to you. for emulators an tape-file is absolut unnecessary.
a better title of this post would be convert .prg to .wav or .mp3.

do you know also a method to convert a .prg to a soundfile?
...
Mike wrote: Sun Mar 15, 2020 12:30 pm When you have loaded the file from disk, with an unexpanded VIC-20, proceed as follows:
  • clear the screen with SHIFT + CLR
  • issue POKE55,250:POKE56,31:CLR
  • do the save, i.e. SAVE "<name>"
This uses the screen as temporary storage for the file name. When you go with the cursor to the bottom-right corner, you'll see the filename (most probably in shifted characters, hold C= + Shift to see what I mean), in white letters on white background.

With POKE55,0:POKE56,30:CLR you revert to the normal RAM configuration for unexpanded VIC-20.
perfect :!: it works :mrgreen:

it proofs that the programm ist tape compatible.
Mike wrote: Sun Mar 15, 2020 12:30 pm One other thing:

If your program includes a BASIC stub (xxxx SYS xxxx) DO NOT save it from $1000! BASIC programs saved as file do not include the zero byte before the BASIC start, but start with the link pointer (more details here: "Starting addr for .prgs").
my code starts so:

Code: Select all

*=$1001
!byte $0b,$08, $e2,$07, $9e, $20, $37, $31, $36, $38, $00,$00, $00

 *=$100e
 ...
 here are some functions which i copied later on to other adresses
 
in 7168 are some initial and copy routines.

after the welcome screen my characters stored from $1000 to ...

maybe i break some rules but ...
i can say it seems to work.

thanks for your help!!

aitsch
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: how to convert a .prg to .t64 ?

Post by Mike »

aitsch wrote:hm... i agree to you. for emulators an tape-file is absolut unnecessary.
a better title of this post would be convert .prg to .wav or .mp3.

do you know also a method to convert a .prg to a soundfile?
Some time ago I used TAPWAV for this purpose, unfortunately it won't run anymore with Windows 10. :(

WAV-PRG seems to do the same job, but I did not try it yet. Note: even if they say it's for (PAL) C64, it will also work for (PAL) VIC-20 data. Generally, a machine with a faster CPU clock can read tapes written by a machine with a slower CPU clock, but not to other way round (gives ?LOAD errors). Therefore, using a PAL C64 a reference guarantees the resulting *.tap files can be read everywhere.

(actually you can do the same thing in VICE ... just attach a tape and then do the same steps as I outlined above, with the program loaded in beforehand).

With Audiotap, you'd then convert between *.tap and *.wav. Do not use *.mp3 (the reasons for this explained elsewhere).
after the welcome screen my characters stored from $1000 to ...

maybe i break some rules but ...
i can say it seems to work.
Writing to $1000 and following after the program has started is perfectly legit, as long as you don't intend to return to BASIC. If you do, you again need to provide a valid BASIC program at the BASIC start (even if it is just empty, two zeros), the byte before the BASIC start (here, $1000) set to 0 again, and all relevant pointers and BASIC workspace in working order.

Most probably, the simplest way to achieve this is to call the KERNAL reset routine at $FD22. :mrgreen:
User avatar
aitsch
Vic 20 Amateur
Posts: 51
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

Re: how to convert a .prg to .t64 ?

Post by aitsch »

Mike wrote: Sun Mar 15, 2020 2:24 pm ...

Most probably, the simplest way to achieve this is to call the KERNAL reset routine at $FD22. :mrgreen:
hehe ... this is exactly what i'am doing at the end.

:D
Post Reply