1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
// tzx.cpp
// Revision 4-dec-2004
#include "tzx.h"
#include "pasmotypes.h"
#include <assert.h>
#define ASSERT assert
void tzx::writefilehead (std::ostream & out)
{
// TZX header.
static const char tzxhead []= {
'Z', 'X', 'T', 'a', 'p', 'e', '!', 0x1A, // TZX ID.
1, 13, // TZX format version.
};
out.write (tzxhead, sizeof (tzxhead) );
}
void tzx::writestandardblockhead (std::ostream & out)
{
out.put ('\x10'); // Standard speed block.
address pause= 1000; // Pause after block in milisecs.
out.put (lobyte (pause) );
out.put (hibyte (pause) );
}
void tzx::writeturboblockhead (std::ostream & out, size_t len)
{
ASSERT (len <= 0xFFFFFF);
out.put (0x11); // Block type.
putword (out, 0x0380); // Pilot pulse
putword (out, 0x01C0); // Sync first pulse
putword (out, 0x01C0); // Sync second pulse
putword (out, 0x01C0); // Zero bit pulse
putword (out, 0x0380); // One bit pulse
putword (out, 0x1000); // Pilot tone
out.put (0x08); // Bits used in last byte
//putword (out, 0x03E8); // Pause after block
putword (out, 0x0970); // Pause after block
// Length of data
putword (out, len & 0xFFFF);
out.put ( (len >> 16) & 0xFF);
}
// End of tzx.cpp
|