Skip to content

Commit

Permalink
SAP Loader : SAP_LOADER_GAP3_VALUE to change/force the GAP 3 length.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdelnero committed Jan 4, 2025
1 parent 7594d70 commit 8f0923f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 58 deletions.
8 changes: 7 additions & 1 deletion libhxcfe/sources/init.script
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,13 @@ set HFE_WRITER_WRITENOTALLOWED 0 # If = 0 -> Image is not w

set CPCDSK_WRITER_LIMIT_SECTOR_SIZE 1 # Limit the sector data to 6144 bytes
set CPCDSK_WRITER_DISCARD_UNFORMATTED_SIDE 1
set CPCDSK_WRITER_GAP3_VALUE -1 # Set the desired value or -1 for auto
set CPCDSK_WRITER_GAP3_VALUE -1 # Set the desired GAP 3 value or -1 for auto

#
# SAP Loader parameters
#

set SAP_LOADER_GAP3_VALUE -1 # Set the desired GAP 3 value or -1 for auto

#
# Oric DSK Loader / Writer parameters
Expand Down
113 changes: 58 additions & 55 deletions libhxcfe/sources/init_script.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//
// File: init.script
//
// Original size: 14537 Bytes
// Packed size: 6856 Bytes
// Original size: 14672 Bytes
// Packed size: 6910 Bytes
//

#ifndef DATATYPEDEF
Expand Down Expand Up @@ -402,61 +402,64 @@ static unsigned char data__init_script[] =
0x60,0x8a,0x45,0x0e,0x28,0xb0,0xfd,0x45,0x6b,0x6f,0xca,0xc2,0x05,0x26,0xfc,0xba,
0x98,0x08,0xc3,0xd9,0x2b,0x38,0x15,0x0c,0x68,0xe2,0x36,0x2d,0x91,0x44,0x90,0xd1,
0x62,0x31,0x54,0x51,0xa1,0xf6,0x3d,0x20,0x23,0x9c,0xe8,0x06,0x6e,0x34,0x22,0x6a,
0x39,0x8a,0x90,0xa9,0x38,0xa7,0xa1,0xf8,0x40,0xa1,0x5d,0x1d,0xc0,0x85,0x42,0x80,
0x16,0xc3,0x93,0x0b,0x9e,0x30,0x03,0x64,0x5d,0xf0,0x1b,0xd4,0x5e,0xe5,0xe8,0x4c,
0xc4,0xe6,0x27,0x62,0xce,0x89,0xeb,0x6e,0x62,0x7f,0x0f,0x48,0x3b,0x04,0x50,0x7b,
0x26,0x1f,0x8a,0x2a,0xd7,0xc7,0x8c,0x04,0x74,0x73,0x8f,0x45,0x48,0x25,0x64,0x1f,
0x79,0x8c,0x1a,0x60,0xd9,0x51,0xcd,0x9b,0xed,0x85,0x61,0xee,0x37,0x9a,0x14,0x62,
0xac,0x14,0xe1,0x82,0x08,0x54,0x34,0x8f,0xec,0x5a,0x84,0x45,0x62,0x48,0xd8,0x61,
0x02,0xa6,0xf8,0x33,0x86,0xeb,0x2c,0x9c,0x4d,0x48,0xb2,0x90,0xe4,0xfd,0x01,0x08,
0x32,0x22,0xf7,0x59,0xc0,0xb8,0x80,0x40,0x04,0x50,0x36,0xac,0xf5,0x58,0x90,0xa2,
0x6a,0x48,0xa5,0xcf,0x78,0x05,0x44,0x09,0x00,0x80,0x05,0x71,0x36,0x02,0x62,0x7a,
0x06,0xce,0x97,0xf0,0xd1,0x16,0x34,0x33,0x02,0x84,0x76,0xf1,0x0a,0xe3,0x82,0xdf,
0xc1,0xef,0x13,0x3c,0x09,0xef,0x30,0x02,0xcb,0xc3,0x4e,0x72,0xe5,0x42,0x19,0xb5,
0xfc,0xfd,0x45,0x68,0x6e,0x59,0x0b,0xdb,0x04,0x47,0xf2,0xe5,0xa8,0xbd,0x66,0xb0,
0x57,0x19,0x34,0x66,0x05,0x62,0x2d,0x40,0xe9,0x80,0xb4,0x77,0x81,0x40,0x09,0x00,
0x74,0xd1,0x34,0x6a,0xc0,0xc7,0x47,0x15,0x67,0x42,0xc0,0x2f,0xc8,0xee,0x23,0x92,
0x66,0x75,0x62,0x0a,0xde,0x40,0x41,0x3c,0x43,0x43,0xb7,0x54,0x78,0xa4,0x62,0x0d,
0x9f,0x25,0x01,0x8d,0xc3,0x2a,0xe3,0x4a,0xc7,0x9e,0x04,0x43,0xf6,0x12,0x44,0x04,
0x44,0x27,0x01,0x90,0x0b,0x88,0xfe,0x03,0x80,0x17,0x11,0x4c,0x05,0xc0,0x37,0x4b,
0x78,0xd1,0x85,0x66,0x10,0xe0,0x2f,0x8b,0x81,0x67,0x20,0x79,0x18,0xcc,0x6b,0x40,
0x85,0x22,0xc8,0xaa,0x01,0x0c,0xeb,0x81,0x3c,0x58,0xb0,0x18,0x46,0x00,0x2e,0x75,
0x3e,0x16,0x3c,0x22,0x21,0x1d,0x0b,0xb8,0xc3,0x44,0xd4,0x20,0xb8,0x96,0x07,0xbd,
0xa4,0xa3,0x9f,0x10,0xd8,0x8c,0xd2,0xa3,0x15,0x51,0x43,0x0e,0xe6,0x2a,0x71,0xad,
0x55,0x34,0x8c,0xca,0x3e,0x03,0xe0,0x1e,0x94,0x10,0x5e,0x60,0x43,0x81,0x78,0x76,
0x4b,0x36,0x16,0xa1,0x30,0x40,0xe6,0x35,0x8a,0xc4,0x37,0x70,0x9a,0x04,0x0a,0xe3,
0xc0,0x21,0x10,0xdd,0xd1,0x24,0xba,0x02,0x83,0xa2,0x1b,0xf6,0x93,0x14,0x99,0x91,
0x31,0x5b,0x91,0x88,0x32,0xa2,0xa3,0xc5,0xe4,0x5d,0xa8,0x88,0x46,0x0e,0x4b,0x01,
0x11,0x92,0xd4,0x55,0x14,0x08,0x6e,0xf4,0xa8,0x12,0xb8,0x31,0xa2,0x64,0x59,0x19,
0x95,0xc6,0x26,0x02,0xd3,0x95,0x8b,0xcc,0x75,0xa0,0x6e,0x01,0x3c,0x43,0xdb,0x73,
0x01,0xf2,0x6f,0x44,0x7a,0x4e,0x41,0x4d,0x93,0xa1,0xff,0xe4,0xb6,0x1a,0x93,0xdd,
0xc9,0x82,0x4c,0x4a,0xd7,0x93,0x24,0x99,0x9c,0x25,0x26,0x85,0x6c,0x01,0x05,0x5b,
0x90,0xd3,0x31,0xc9,0xa4,0x4e,0x48,0x1b,0x32,0x4e,0x9a,0x4c,0x34,0x08,0xd2,0x62,
0x89,0x9e,0x8d,0x86,0xa3,0x70,0xc6,0x0d,0xac,0x4e,0x63,0x55,0x57,0x58,0x52,0x08,
0xdc,0x91,0xa4,0xdf,0x17,0x70,0x3d,0xb2,0x4a,0x20,0x18,0x52,0xcd,0x68,0x4c,0x93,
0x32,0x8c,0x88,0xa3,0xe2,0x1b,0x4a,0x78,0x55,0x05,0xa2,0x75,0xb0,0x37,0x19,0x95,
0x23,0x46,0x03,0x67,0x30,0xbc,0xc0,0xda,0x07,0x91,0xbe,0x80,0xba,0x57,0x89,0x7c,
0x96,0x38,0xdf,0x40,0xbf,0x2b,0xc0,0x17,0x0b,0x46,0x53,0xab,0x0a,0x8a,0x94,0x07,
0x40,0xe4,0x6e,0x82,0x9d,0x4a,0x9d,0x7e,0xb2,0xad,0x3b,0x08,0xee,0x04,0x54,0x7a,
0x89,0x65,0x8d,0xd6,0x57,0xf2,0xb8,0x0e,0xc4,0xb0,0xc3,0xee,0x60,0x42,0x9a,0xcb,
0x34,0x71,0x32,0xca,0x03,0x20,0x6b,0x88,0xd1,0x2e,0xa0,0xb4,0xcb,0x44,0x21,0xca,
0x3c,0x72,0x88,0x15,0x0e,0x7e,0xaf,0x65,0x7c,0x10,0x75,0xb9,0x6b,0x8b,0x20,0x9a,
0xa1,0x4e,0x7c,0xa4,0x25,0x2d,0xa0,0x31,0x50,0x24,0x50,0x78,0xf3,0x67,0x51,0xce,
0x42,0x03,0x51,0x27,0x6c,0x23,0xac,0xe2,0x46,0xb0,0x58,0xa5,0x1e,0x85,0x16,0xc4,
0x8b,0xd1,0x3d,0x02,0x0f,0x29,0x5a,0xd0,0xa2,0x98,0x9f,0x85,0x2d,0x0f,0x31,0xf2,
0xe4,0xbe,0x89,0xd3,0xaa,0x94,0x5f,0x30,0xc6,0x72,0x26,0xf0,0x33,0xed,0x34,0x0a,
0xfa,0x07,0x40,0x44,0x66,0x75,0x38,0x1c,0x54,0x29,0x01,0x89,0x36,0x38,0xc4,0x23,
0x32,0x97,0xd4,0xf8,0x91,0x31,0x4b,0x30,0xbe,0x39,0xba,0x96,0x95,0x16,0x17,0xd9,
0x94,0x21,0x6c,0x29,0xc8,0x26,0x11,0x24,0x89,0x48,0x1c,0x73,0x91,0xe2,0x3d,0xc5,
0x4b,0x32,0xf5,0x97,0xb9,0x2e,0xe5,0xf2,0x3e,0x50,0x29,0x9c,0xfa,0x01,0xe8,0x42,
0x01,0x12,0x5b,0xe6,0x7e,0x9a,0x49,0xa1,0x20,0x32,0x68,0x84,0xb9,0x9a,0x33,0x54,
0x07,0xca,0x87,0x66,0xe1,0x01,0x26,0x69,0x93,0x4e,0x83,0xbc,0xd4,0x26,0x65,0x35,
0x24,0xd5,0xcd,0x15,0x5e,0xf3,0x56,0x94,0xcb,0xd6,0x4d,0x3f,0x16,0xb0,0x29,0x45,
0xb4,0xf9,0xb3,0x4f,0x9a,0x0c,0xd7,0xe6,0x0a,0x4b,0x32,0x26,0x4d,0x98,0x0a,0x93,
0x68,0x9b,0x51,0x6f,0xc0,0x00,0x10,0x00
0x39,0x8a,0x90,0xa9,0x38,0xa7,0xa1,0xf8,0x40,0xa1,0x5d,0x1d,0xc0,0x85,0x42,0x81,
0x17,0x91,0x50,0xbf,0x14,0x2d,0x87,0x26,0x17,0x3c,0x60,0x06,0xc8,0xbb,0xe0,0x37,
0xb0,0xd4,0xe7,0x51,0x3b,0x87,0x9a,0xdf,0xa0,0xec,0x11,0x48,0x5f,0x34,0xad,0x6b,
0xf1,0x88,0x8b,0xdb,0x8d,0x62,0xfc,0x78,0xf8,0xc0,0x23,0xbc,0xfa,0xd1,0x83,0x0b,
0x50,0x1a,0x63,0x0c,0xde,0xc8,0xc9,0xc6,0x28,0xe4,0xa1,0xa5,0x0c,0xfc,0x63,0x85,
0xcf,0x19,0x05,0x17,0xb9,0x7a,0x13,0x31,0x39,0x8c,0xa0,0x67,0xe2,0x7a,0xdb,0x98,
0x9f,0xc3,0xd2,0x32,0xea,0x30,0x87,0xd4,0x51,0x22,0xea,0xb5,0xf1,0xe3,0x01,0x1d,
0x1c,0xe3,0xd1,0x52,0x09,0x59,0x07,0xde,0x63,0x06,0x98,0x36,0x54,0x73,0x66,0xfb,
0x61,0x58,0x7b,0x8d,0xe6,0x85,0x18,0xab,0x05,0x38,0x60,0x82,0x15,0x0d,0x23,0xfb,
0x16,0xa1,0x11,0x58,0x92,0x36,0x18,0x40,0xa9,0xbe,0x0c,0xe1,0xba,0xcb,0x27,0x13,
0x52,0x2c,0xa4,0x39,0x3f,0x40,0x42,0x0c,0x88,0xbd,0xd6,0x70,0x2e,0x20,0x10,0x01,
0x14,0x0d,0xab,0x3d,0x56,0x24,0x28,0x9a,0x92,0x29,0x73,0xde,0x01,0x51,0x02,0x40,
0x20,0x01,0x5c,0x4d,0x80,0x98,0x9e,0x81,0xb3,0xa5,0xfc,0x34,0x45,0x8d,0x0c,0xc0,
0xa1,0x1d,0xbc,0x42,0xb8,0xf1,0xb7,0xf0,0x7b,0xc4,0xcf,0x02,0x7b,0xcc,0x00,0xb2,
0xf0,0xd3,0x9c,0xb9,0x50,0x86,0x6d,0x7f,0x3f,0x51,0x5a,0x1b,0x96,0x42,0xf6,0xc1,
0x11,0xfc,0xb9,0x6a,0x2f,0x59,0xac,0x15,0xc6,0x4d,0x1b,0xa1,0x58,0x8b,0x50,0x3a,
0x60,0x2d,0x1d,0xe0,0x50,0x02,0x40,0x1d,0x34,0x4d,0x1a,0xb0,0x31,0xd1,0xe7,0x59,
0xd0,0xb0,0x0b,0xf2,0x3b,0x88,0xf5,0x99,0x9d,0x58,0x82,0xb7,0x91,0x20,0x4f,0x10,
0xd0,0xed,0xd5,0x1e,0x29,0x18,0x83,0x67,0xc9,0x40,0x63,0x70,0xca,0xb8,0xd2,0xb1,
0xe7,0x81,0x10,0xfd,0x84,0x91,0x01,0x11,0x09,0xc0,0x64,0x02,0xe2,0x3f,0x80,0xe0,
0x05,0xc4,0x53,0x01,0x70,0x0d,0xd2,0xde,0x34,0x61,0x59,0x84,0x38,0x0b,0xe2,0xe0,
0x59,0xc8,0x1e,0x46,0x33,0x1c,0xf0,0x21,0x49,0x3a,0x2a,0x80,0x43,0x3a,0xe0,0x4f,
0x16,0x2c,0x06,0x11,0x80,0x0b,0x9d,0x4f,0x85,0x8f,0x08,0x88,0x47,0x42,0xee,0x30,
0xd1,0x35,0x08,0x2e,0x25,0x81,0xef,0x69,0x28,0xe7,0xc4,0x36,0x23,0x34,0xa8,0xc5,
0x54,0x50,0xc3,0xb9,0x8a,0x9c,0x73,0xd5,0x4d,0x25,0x52,0x8f,0x80,0xf8,0x07,0xa5,
0x04,0x17,0x98,0x10,0xe0,0x5e,0x1d,0x92,0xcd,0x85,0xa8,0x4c,0x10,0x39,0x8e,0x72,
0xb1,0x0d,0xdc,0x26,0x81,0x02,0xb8,0xf0,0x08,0x44,0x37,0x74,0x49,0x2e,0x80,0xa0,
0xe8,0x86,0xfd,0xa4,0xc5,0x26,0x64,0x4c,0x56,0xe4,0x62,0xcc,0xa8,0xa8,0xf1,0x79,
0x17,0x6a,0x22,0x11,0xa4,0x0a,0x68,0x44,0x64,0xf9,0x15,0x45,0x02,0x1b,0xbd,0x2a,
0x04,0xae,0x0c,0x68,0x99,0x16,0x46,0x65,0x71,0x89,0x80,0xb4,0xe5,0x62,0xf3,0x1d,
0x68,0x1b,0x80,0x4f,0x10,0xf6,0xdc,0xc0,0x7c,0x9b,0xd1,0x1e,0x94,0xa4,0x9e,0xcf,
0xff,0x27,0xd0,0xd4,0x9e,0xee,0x50,0x52,0x84,0x56,0xbc,0xa1,0xa5,0x10,0xe1,0x29,
0x45,0x2b,0x60,0x08,0x2a,0xdc,0x86,0x99,0x8e,0x4d,0x22,0x72,0x40,0xd9,0x92,0x74,
0xd2,0x61,0xa0,0x46,0x93,0x14,0x4c,0xf4,0x6c,0x35,0x1b,0x86,0x30,0x6d,0x62,0x73,
0x1a,0xaa,0xba,0xc2,0x90,0x46,0xe4,0x8d,0x26,0xf8,0xbb,0x81,0xed,0x93,0x61,0x00,
0xc2,0x96,0x6b,0x42,0x64,0x99,0x94,0x64,0x45,0x1f,0x10,0xda,0x53,0xc2,0xa8,0x2d,
0x13,0xad,0x81,0xb8,0xcc,0xa9,0x1a,0x30,0x1b,0x39,0x85,0xe6,0x06,0xd0,0x3c,0x8d,
0xf4,0x05,0xd2,0xdd,0x4b,0xe4,0xba,0x06,0xfa,0x05,0xf9,0x6e,0x80,0xb8,0x5a,0x32,
0xbe,0x58,0x54,0x54,0xa0,0x3a,0x07,0x23,0x74,0x14,0xea,0x59,0x0b,0xf5,0x96,0x71,
0xd8,0x47,0x70,0x22,0xa3,0xd4,0x4b,0xb0,0x6e,0xb2,0xe0,0x96,0xc8,0x76,0x25,0xc8,
0x1f,0x73,0x02,0x14,0xd6,0x5d,0xc3,0x89,0x97,0x58,0x19,0x03,0x5c,0x46,0x89,0x85,
0x85,0xa6,0x5e,0x41,0x0e,0x51,0xe3,0x94,0x40,0xa8,0x73,0xf5,0x7b,0x2b,0xe0,0x83,
0xad,0xcb,0x5c,0x59,0x04,0xd5,0x0a,0x73,0xe5,0x21,0x29,0x6d,0x01,0x8a,0x81,0x22,
0x83,0xc7,0x9b,0x3a,0x8e,0x72,0x10,0x1a,0x89,0x3b,0x61,0x1d,0x67,0x12,0x35,0x82,
0xc5,0x2b,0x04,0x28,0xb6,0x24,0x5e,0x89,0xe8,0x10,0x79,0x4a,0xd6,0x85,0x14,0xc4,
0xfc,0x29,0x68,0x79,0x8f,0x97,0x25,0xf4,0x4e,0x9d,0x54,0xa2,0xf9,0x96,0xb3,0x91,
0x37,0x81,0x9f,0x69,0xa0,0x57,0xd0,0x3a,0x02,0x23,0x33,0xa9,0xc0,0xe2,0xa1,0x48,
0x0c,0x49,0xb1,0xc6,0x21,0x1b,0xb0,0x2a,0xa7,0xc4,0x89,0x8a,0x59,0x85,0xf1,0xcd,
0xd4,0xb4,0xa8,0xb0,0xbe,0xcd,0x25,0x0b,0x61,0x4e,0x41,0x30,0x89,0x24,0x8e,0x40,
0xe3,0x9c,0x8f,0x11,0xee,0x2a,0x59,0x98,0xb4,0xc6,0x09,0x77,0x31,0xa1,0xf2,0x81,
0x4c,0xe7,0xd0,0x0f,0x42,0x10,0x08,0x92,0xdf,0x36,0x04,0xd2,0x4d,0x8d,0x01,0x93,
0x65,0x25,0xcc,0xd9,0xda,0xa0,0x3e,0x54,0x3b,0x37,0x08,0x09,0x33,0x6d,0x9b,0x7c,
0x1d,0xe6,0xe3,0x35,0x39,0xb9,0xa6,0xae,0x6c,0xca,0xf7,0x9b,0xbc,0xae,0x9e,0xb2,
0x69,0xf8,0xb5,0x81,0x4a,0x2d,0xa7,0xcd,0x9b,0x84,0xd8,0xa7,0x01,0x32,0x62,0x59,
0x91,0x32,0x70,0xe0,0x54,0x9c,0x4c,0xe2,0xcb,0x7e,0x00,0x00,0x80,0x00
};

static datatype data_init_script[]=
{
{ 255, 14537, 6856, data__init_script, 0 }
{ 255, 14672, 6910, data__init_script, 0 }
};
7 changes: 5 additions & 2 deletions libhxcfe/sources/loaders/sap_loader/sap_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ int SAP_libLoad_DiskFile(HXCFE_IMGLDR * imgldr_ctx,HXCFE_FLOPPY * floppydisk,cha
return -1;
}

gap3len = 255;
gap3len = hxcfe_getEnvVarValue( imgldr_ctx->hxcfe, "SAP_LOADER_GAP3_VALUE" );
if(gap3len < 0)
gap3len = 255;

interleave = 7;
skew = 0;

Expand Down Expand Up @@ -166,7 +169,7 @@ int SAP_libLoad_DiskFile(HXCFE_IMGLDR * imgldr_ctx,HXCFE_FLOPPY * floppydisk,cha
sap_ReadSector(sapid, j, k+1, &sapsector);
imgldr_ctx->hxcfe->hxc_printf(MSG_DEBUG,"[%.2d:%.2d]: Sect %.2d, Track %.2d, Format: 0x%.2x, Protect 0x%.2x",j,k,sapsector.sector,sapsector.track,sapsector.format,sapsector.protection);
sectorconfig[k].bitrate=250000;
sectorconfig[k].gap3=255;
sectorconfig[k].gap3=gap3len;
sectorconfig[k].head=0;
sectorconfig[k].trackencoding=trackformat;
sectorconfig[k].sector=sapsector.sector;
Expand Down

0 comments on commit 8f0923f

Please sign in to comment.