diff --git a/XTMax/Code/XTMax/XTMax.ino b/XTMax/Code/XTMax/XTMax.ino index 2bb8b56..b063d62 100644 --- a/XTMax/Code/XTMax/XTMax.ino +++ b/XTMax/Code/XTMax/XTMax.ino @@ -172,7 +172,7 @@ #define EMS_TOTAL_SIZE (16*1024*1024) -#define SD_BASE 0x280 // Must be a multiple of 8. +#define SD_BASE 0x280 // Must be a multiple of 16. // -------------------------------------------------------------------------------------------------- @@ -198,6 +198,8 @@ uint8_t sd_spi_datain =0; uint32_t sd_spi_cs_n = 0x0; uint32_t sd_spi_dataout =0; uint8_t sd_scratch_register[5] = {0, 0, 0, 0, 0}; +uint16_t sd_requested_timeout = 0; +elapsedMillis sd_timeout; uint8_t XTMax_MEM_Response_Array[16]; @@ -676,7 +678,7 @@ inline void IO_Read_Cycle() { } - else if ((isa_address&0x0FF8)==SD_BASE ) { // Location of SD Card registers + else if ((isa_address&0x0FF0)==SD_BASE ) { // Location of SD Card registers switch (isa_address) { case SD_BASE: // First two registers serve the same function (to allow use of Word I/O) @@ -687,6 +689,8 @@ inline void IO_Read_Cycle() { case SD_BASE+5: isa_data_out = sd_scratch_register[2]; break; case SD_BASE+6: isa_data_out = sd_scratch_register[3]; break; case SD_BASE+7: isa_data_out = sd_scratch_register[4]; break; + case SD_BASE+15: isa_data_out = sd_timeout >= sd_requested_timeout; break; + default: isa_data_out = 0xff; break; } GPIO7_DR = GPIO7_DATA_OUT_UNSCRAMBLE + MUX_ADDR_n_LOW + CHRDY_OUT_LOW + trigger_out; @@ -735,7 +739,7 @@ inline void IO_Write_Cycle() { } - else if ((isa_address&0x0FF8)==SD_BASE ) { // Location of SD Card registers + else if ((isa_address&0x0FF0)==SD_BASE ) { // Location of SD Card registers GPIO7_DR = GPIO7_DATA_OUT_UNSCRAMBLE + MUX_ADDR_n_HIGH + CHRDY_OUT_LOW + trigger_out; GPIO8_DR = sd_pin_outputs + MUX_DATA_n_LOW + CHRDY_OE_n_HIGH + DATA_OE_n_HIGH; @@ -752,6 +756,7 @@ inline void IO_Write_Cycle() { case SD_BASE+5: sd_scratch_register[2] = data_in; break; case SD_BASE+6: sd_scratch_register[3] = data_in; break; case SD_BASE+7: sd_scratch_register[4] = data_in; break; + case SD_BASE+15: sd_timeout = 0; sd_requested_timeout = data_in * 10; break; } //gpio9_int = GPIO9_DR; diff --git a/XTMax/Code/XTMax/bootrom.h b/XTMax/Code/XTMax/bootrom.h index 13bf3cc..6f94220 100644 --- a/XTMax/Code/XTMax/bootrom.h +++ b/XTMax/Code/XTMax/bootrom.h @@ -1,18 +1,18 @@ #define BOOTROM_ADDR 0xCE000 unsigned char BOOTROM[] = { - 85, 170, 4, 6, 80, 82, 250, 184, 17, 229, 232, 127, 4, 232, 135, 3, + 85, 170, 4, 6, 80, 82, 250, 184, 29, 229, 232, 139, 4, 232, 161, 3, 115, 3, 233, 186, 0, 84, 88, 57, 224, 116, 33, 62, 161, 255, 255, 62, 199, 6, 255, 255, 170, 170, 62, 128, 62, 0, 0, 170, 62, 163, 255, 255, - 117, 10, 80, 48, 192, 176, 64, 246, 224, 88, 117, 10, 178, 1, 184, 83, - 229, 232, 72, 4, 235, 2, 48, 210, 184, 131, 2, 146, 238, 184, 120, 229, - 232, 57, 4, 49, 192, 142, 192, 38, 161, 78, 0, 186, 132, 2, 239, 232, - 72, 4, 184, 35, 230, 232, 36, 4, 38, 161, 76, 0, 186, 134, 2, 239, - 232, 55, 4, 184, 39, 230, 232, 19, 4, 184, 141, 229, 232, 13, 4, 184, - 0, 192, 38, 163, 78, 0, 232, 33, 4, 184, 35, 230, 232, 253, 3, 184, - 212, 224, 38, 163, 76, 0, 232, 17, 4, 184, 39, 230, 232, 237, 3, 184, - 162, 229, 232, 231, 3, 184, 0, 192, 38, 163, 6, 1, 232, 251, 3, 184, - 35, 230, 232, 215, 3, 184, 136, 225, 38, 163, 4, 1, 232, 235, 3, 184, - 39, 230, 232, 199, 3, 184, 64, 0, 142, 192, 38, 254, 6, 117, 0, 251, + 117, 10, 80, 48, 192, 176, 64, 246, 224, 88, 117, 10, 178, 1, 184, 95, + 229, 232, 84, 4, 235, 2, 48, 210, 184, 131, 2, 146, 238, 184, 132, 229, + 232, 69, 4, 49, 192, 142, 192, 38, 161, 78, 0, 186, 132, 2, 239, 232, + 84, 4, 184, 47, 230, 232, 48, 4, 38, 161, 76, 0, 186, 134, 2, 239, + 232, 67, 4, 184, 51, 230, 232, 31, 4, 184, 153, 229, 232, 25, 4, 184, + 0, 192, 38, 163, 78, 0, 232, 45, 4, 184, 47, 230, 232, 9, 4, 184, + 212, 224, 38, 163, 76, 0, 232, 29, 4, 184, 51, 230, 232, 249, 3, 184, + 174, 229, 232, 243, 3, 184, 0, 192, 38, 163, 6, 1, 232, 7, 4, 184, + 47, 230, 232, 227, 3, 184, 136, 225, 38, 163, 4, 1, 232, 247, 3, 184, + 51, 230, 232, 211, 3, 184, 64, 0, 142, 192, 38, 254, 6, 117, 0, 251, 90, 88, 7, 203, 85, 86, 128, 250, 128, 116, 26, 137, 197, 137, 214, 156, 14, 184, 47, 225, 80, 156, 186, 132, 2, 237, 80, 186, 134, 2, 237, 80, 137, 232, 137, 242, 207, 128, 252, 21, 126, 5, 232, 113, 0, 235, 34, 128, @@ -20,85 +20,86 @@ unsigned char BOOTROM[] = { 225, 86, 137, 222, 136, 227, 48, 255, 208, 227, 135, 222, 46, 255, 164, 66, 225, 140, 197, 190, 64, 0, 142, 198, 38, 136, 38, 116, 0, 142, 197, 137, 229, 139, 118, 8, 86, 115, 4, 157, 249, 235, 2, 157, 248, 94, 93, 202, - 2, 0, 43, 227, 152, 225, 172, 225, 61, 226, 236, 226, 110, 225, 110, 225, - 110, 225, 7, 227, 43, 227, 110, 225, 110, 225, 29, 227, 43, 227, 110, 225, - 110, 225, 43, 227, 43, 227, 110, 225, 110, 225, 43, 227, 45, 227, 80, 184, - 6, 230, 232, 23, 3, 88, 80, 136, 224, 48, 228, 232, 44, 3, 184, 39, - 230, 232, 8, 3, 88, 233, 178, 1, 0, 4, 255, 0, 0, 255, 255, 0, + 2, 0, 69, 227, 152, 225, 172, 225, 67, 226, 6, 227, 110, 225, 110, 225, + 110, 225, 33, 227, 69, 227, 110, 225, 110, 225, 55, 227, 69, 227, 110, 225, + 110, 225, 69, 227, 69, 227, 110, 225, 110, 225, 69, 227, 71, 227, 80, 184, + 18, 230, 232, 35, 3, 88, 80, 136, 224, 48, 228, 232, 56, 3, 184, 51, + 230, 232, 20, 3, 88, 233, 204, 1, 0, 4, 255, 0, 0, 255, 255, 0, 200, 0, 0, 0, 0, 0, 63, 0, 6, 189, 64, 0, 142, 197, 48, 228, 38, 134, 38, 116, 0, 132, 228, 116, 1, 249, 7, 195, 132, 192, 117, 3, - 233, 135, 1, 80, 48, 228, 137, 198, 83, 232, 138, 1, 137, 197, 1, 240, - 137, 222, 131, 211, 0, 232, 177, 1, 91, 88, 115, 3, 233, 111, 1, 83, + 233, 161, 1, 80, 48, 228, 137, 198, 83, 232, 164, 1, 137, 197, 1, 240, + 137, 222, 131, 211, 0, 232, 203, 1, 91, 88, 115, 3, 233, 137, 1, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, 186, 130, 2, 176, 0, 238, - 81, 137, 232, 137, 243, 177, 81, 232, 113, 2, 114, 64, 186, 128, 2, 185, - 80, 195, 235, 3, 232, 135, 2, 236, 60, 254, 224, 248, 117, 46, 185, 0, - 1, 82, 186, 131, 2, 236, 90, 132, 192, 252, 116, 4, 243, 109, 235, 4, - 237, 171, 226, 252, 237, 131, 197, 1, 131, 214, 0, 89, 226, 194, 186, 130, - 2, 176, 1, 238, 88, 95, 90, 89, 91, 233, 22, 1, 186, 130, 2, 176, - 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 233, 249, 0, 132, 192, 117, - 3, 233, 246, 0, 80, 48, 228, 137, 198, 83, 232, 249, 0, 137, 197, 1, - 240, 137, 222, 131, 211, 0, 232, 32, 1, 91, 88, 115, 3, 233, 222, 0, - 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, 140, 192, 142, 216, - 186, 130, 2, 176, 0, 238, 81, 137, 232, 137, 243, 177, 88, 232, 219, 1, - 114, 89, 186, 128, 2, 176, 254, 238, 185, 0, 1, 135, 247, 82, 186, 131, - 2, 236, 90, 132, 192, 252, 116, 4, 243, 111, 235, 4, 173, 239, 226, 252, - 135, 254, 185, 80, 195, 235, 3, 232, 212, 1, 236, 60, 255, 225, 248, 36, - 31, 60, 5, 117, 38, 185, 80, 195, 235, 3, 232, 193, 1, 236, 132, 192, - 225, 248, 116, 23, 131, 197, 1, 131, 214, 0, 89, 226, 169, 186, 130, 2, - 176, 1, 238, 88, 95, 90, 89, 91, 31, 235, 103, 186, 130, 2, 176, 1, - 238, 89, 88, 40, 200, 95, 90, 89, 91, 31, 235, 74, 132, 192, 116, 74, - 80, 48, 228, 137, 197, 83, 232, 77, 0, 1, 232, 131, 211, 0, 232, 120, - 0, 91, 88, 114, 57, 235, 59, 182, 254, 6, 184, 64, 0, 142, 192, 38, - 138, 22, 117, 0, 7, 181, 254, 177, 255, 49, 192, 248, 195, 80, 83, 232, - 36, 0, 232, 84, 0, 91, 88, 114, 21, 235, 23, 235, 21, 180, 3, 232, - 94, 0, 135, 209, 248, 195, 180, 170, 249, 195, 180, 1, 249, 195, 180, 4, - 249, 195, 48, 228, 248, 195, 49, 192, 49, 219, 82, 81, 82, 136, 200, 36, - 192, 209, 224, 209, 224, 136, 232, 185, 255, 0, 247, 225, 90, 136, 241, 48, - 237, 1, 200, 177, 63, 247, 225, 89, 81, 48, 237, 128, 225, 63, 73, 1, - 200, 131, 210, 0, 137, 211, 89, 90, 195, 81, 82, 232, 18, 0, 57, 211, - 114, 10, 119, 4, 57, 200, 114, 4, 249, 90, 89, 195, 248, 90, 89, 195, - 186, 250, 0, 185, 63, 197, 195, 80, 30, 83, 81, 82, 86, 184, 0, 192, - 142, 216, 186, 130, 2, 176, 1, 238, 49, 201, 186, 232, 3, 180, 134, 205, - 21, 186, 128, 2, 176, 255, 185, 80, 0, 238, 226, 253, 186, 130, 2, 176, - 0, 238, 190, 67, 228, 185, 1, 0, 180, 1, 232, 79, 0, 114, 54, 190, - 73, 228, 185, 5, 0, 180, 1, 232, 66, 0, 114, 41, 187, 100, 0, 190, - 79, 228, 185, 1, 0, 180, 1, 232, 50, 0, 190, 85, 228, 185, 1, 0, - 180, 0, 232, 39, 0, 115, 14, 156, 49, 201, 186, 232, 3, 180, 134, 205, - 21, 157, 75, 117, 218, 94, 90, 89, 91, 31, 114, 8, 184, 196, 229, 232, - 122, 0, 88, 195, 184, 231, 229, 232, 114, 0, 88, 195, 186, 128, 2, 176, - 255, 238, 81, 185, 6, 0, 252, 172, 238, 226, 252, 185, 8, 0, 236, 60, - 255, 225, 251, 89, 56, 224, 118, 3, 249, 235, 4, 248, 236, 226, 253, 176, - 255, 238, 195, 64, 0, 0, 0, 0, 149, 72, 0, 0, 1, 170, 135, 119, - 0, 0, 0, 0, 1, 105, 64, 0, 0, 0, 1, 186, 128, 2, 80, 176, - 255, 238, 136, 200, 136, 252, 239, 88, 134, 216, 239, 134, 216, 180, 1, 239, - 185, 8, 0, 236, 60, 255, 225, 251, 132, 192, 116, 1, 249, 195, 81, 82, - 49, 201, 186, 1, 0, 180, 134, 205, 21, 90, 89, 195, 156, 30, 83, 86, - 137, 198, 184, 0, 192, 142, 216, 180, 14, 49, 219, 252, 172, 8, 192, 116, - 4, 205, 16, 235, 247, 94, 91, 31, 157, 195, 156, 30, 83, 81, 82, 86, - 137, 194, 184, 0, 192, 142, 216, 49, 219, 252, 137, 214, 177, 12, 211, 238, - 131, 230, 15, 138, 132, 1, 229, 180, 14, 205, 16, 137, 214, 177, 8, 211, - 238, 131, 230, 15, 138, 132, 1, 229, 180, 14, 205, 16, 137, 214, 177, 4, - 211, 238, 131, 230, 15, 138, 132, 1, 229, 180, 14, 205, 16, 137, 214, 131, - 230, 15, 138, 132, 1, 229, 180, 14, 205, 16, 94, 90, 89, 91, 31, 157, - 195, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, - 70, 66, 111, 111, 116, 82, 79, 77, 32, 102, 111, 114, 32, 88, 84, 77, - 97, 120, 32, 118, 49, 46, 48, 13, 10, 67, 111, 112, 121, 114, 105, 103, - 104, 116, 32, 40, 99, 41, 32, 50, 48, 50, 53, 32, 77, 97, 116, 116, - 104, 105, 101, 117, 32, 66, 117, 99, 99, 104, 105, 97, 110, 101, 114, 105, - 13, 10, 0, 67, 80, 85, 32, 115, 117, 112, 112, 111, 114, 116, 115, 32, - 73, 78, 83, 47, 79, 85, 84, 83, 32, 105, 110, 115, 116, 114, 117, 99, - 116, 105, 111, 110, 115, 13, 10, 0, 79, 108, 100, 32, 73, 78, 84, 49, - 51, 104, 32, 86, 101, 99, 116, 111, 114, 32, 61, 32, 0, 78, 101, 119, - 32, 73, 78, 84, 49, 51, 104, 32, 86, 101, 99, 116, 111, 114, 32, 61, - 32, 0, 78, 101, 119, 32, 70, 105, 120, 101, 100, 32, 68, 105, 115, 107, - 32, 80, 97, 114, 97, 109, 101, 116, 101, 114, 32, 84, 97, 98, 108, 101, - 32, 61, 32, 0, 83, 68, 32, 67, 97, 114, 100, 32, 105, 110, 105, 116, - 105, 97, 108, 105, 122, 101, 100, 32, 115, 117, 99, 99, 101, 115, 115, 102, - 117, 108, 108, 121, 13, 10, 0, 83, 68, 32, 67, 97, 114, 100, 32, 102, - 97, 105, 108, 101, 100, 32, 116, 111, 32, 105, 110, 105, 116, 105, 97, 108, - 105, 122, 101, 13, 10, 0, 85, 110, 115, 117, 112, 112, 111, 114, 116, 101, - 100, 32, 73, 78, 84, 49, 51, 104, 32, 70, 117, 110, 99, 116, 105, 111, - 110, 32, 0, 58, 0, 32, 0, 13, 10, 0, 0, 0, 0, 0, 0, 0, + 81, 137, 232, 137, 243, 177, 81, 232, 139, 2, 114, 70, 186, 143, 2, 176, + 10, 238, 186, 128, 2, 236, 60, 254, 116, 10, 186, 143, 2, 236, 132, 192, + 117, 48, 235, 238, 185, 0, 1, 82, 186, 131, 2, 236, 90, 132, 192, 252, + 116, 4, 243, 109, 235, 4, 237, 171, 226, 252, 237, 131, 197, 1, 131, 214, + 0, 89, 226, 188, 186, 130, 2, 176, 1, 238, 88, 95, 90, 89, 91, 233, + 42, 1, 186, 130, 2, 176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, + 233, 13, 1, 132, 192, 117, 3, 233, 10, 1, 80, 48, 228, 137, 198, 83, + 232, 13, 1, 137, 197, 1, 240, 137, 222, 131, 211, 0, 232, 52, 1, 91, + 88, 115, 3, 233, 242, 0, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, + 137, 223, 140, 192, 142, 216, 186, 130, 2, 176, 0, 238, 81, 137, 232, 137, + 243, 177, 88, 232, 239, 1, 114, 109, 186, 128, 2, 176, 254, 238, 185, 0, + 1, 135, 247, 82, 186, 131, 2, 236, 90, 132, 192, 252, 116, 4, 243, 111, + 235, 4, 173, 239, 226, 252, 135, 254, 186, 143, 2, 176, 25, 238, 186, 128, + 2, 236, 60, 255, 117, 10, 186, 143, 2, 236, 132, 192, 117, 55, 235, 238, + 36, 31, 60, 5, 117, 47, 186, 143, 2, 176, 25, 238, 186, 128, 2, 236, + 132, 192, 117, 10, 186, 143, 2, 236, 132, 192, 117, 25, 235, 238, 131, 197, + 1, 131, 214, 0, 89, 226, 149, 186, 130, 2, 176, 1, 238, 88, 95, 90, + 89, 91, 31, 235, 103, 186, 130, 2, 176, 1, 238, 89, 88, 40, 200, 95, + 90, 89, 91, 31, 235, 74, 132, 192, 116, 74, 80, 48, 228, 137, 197, 83, + 232, 77, 0, 1, 232, 131, 211, 0, 232, 120, 0, 91, 88, 114, 57, 235, + 59, 182, 254, 6, 184, 64, 0, 142, 192, 38, 138, 22, 117, 0, 7, 181, + 254, 177, 255, 49, 192, 248, 195, 80, 83, 232, 36, 0, 232, 84, 0, 91, + 88, 114, 21, 235, 23, 235, 21, 180, 3, 232, 94, 0, 135, 209, 248, 195, + 180, 170, 249, 195, 180, 1, 249, 195, 180, 4, 249, 195, 48, 228, 248, 195, + 49, 192, 49, 219, 82, 81, 82, 136, 200, 36, 192, 209, 224, 209, 224, 136, + 232, 185, 255, 0, 247, 225, 90, 136, 241, 48, 237, 1, 200, 177, 63, 247, + 225, 89, 81, 48, 237, 128, 225, 63, 73, 1, 200, 131, 210, 0, 137, 211, + 89, 90, 195, 81, 82, 232, 18, 0, 57, 211, 114, 10, 119, 4, 57, 200, + 114, 4, 249, 90, 89, 195, 248, 90, 89, 195, 186, 250, 0, 185, 63, 197, + 195, 80, 30, 83, 81, 82, 86, 184, 0, 192, 142, 216, 186, 130, 2, 176, + 1, 238, 49, 201, 186, 232, 3, 180, 134, 205, 21, 186, 128, 2, 176, 255, + 185, 80, 0, 238, 226, 253, 186, 130, 2, 176, 0, 238, 190, 93, 228, 185, + 1, 0, 180, 1, 232, 79, 0, 114, 54, 190, 99, 228, 185, 5, 0, 180, + 1, 232, 66, 0, 114, 41, 187, 100, 0, 190, 105, 228, 185, 1, 0, 180, + 1, 232, 50, 0, 190, 111, 228, 185, 1, 0, 180, 0, 232, 39, 0, 115, + 14, 156, 49, 201, 186, 232, 3, 180, 134, 205, 21, 157, 75, 117, 218, 94, + 90, 89, 91, 31, 114, 8, 184, 208, 229, 232, 108, 0, 88, 195, 184, 243, + 229, 232, 100, 0, 88, 195, 186, 128, 2, 176, 255, 238, 81, 185, 6, 0, + 252, 172, 238, 226, 252, 185, 8, 0, 236, 60, 255, 225, 251, 89, 56, 224, + 118, 3, 249, 235, 4, 248, 236, 226, 253, 176, 255, 238, 195, 64, 0, 0, + 0, 0, 149, 72, 0, 0, 1, 170, 135, 119, 0, 0, 0, 0, 1, 105, + 64, 0, 0, 0, 1, 186, 128, 2, 80, 176, 255, 238, 136, 200, 136, 252, + 239, 88, 134, 216, 239, 134, 216, 180, 1, 239, 185, 8, 0, 236, 60, 255, + 225, 251, 132, 192, 116, 1, 249, 195, 156, 30, 83, 86, 137, 198, 184, 0, + 192, 142, 216, 180, 14, 49, 219, 252, 172, 8, 192, 116, 4, 205, 16, 235, + 247, 94, 91, 31, 157, 195, 156, 30, 83, 81, 82, 86, 137, 194, 184, 0, + 192, 142, 216, 49, 219, 252, 137, 214, 177, 12, 211, 238, 131, 230, 15, 138, + 132, 13, 229, 180, 14, 205, 16, 137, 214, 177, 8, 211, 238, 131, 230, 15, + 138, 132, 13, 229, 180, 14, 205, 16, 137, 214, 177, 4, 211, 238, 131, 230, + 15, 138, 132, 13, 229, 180, 14, 205, 16, 137, 214, 131, 230, 15, 138, 132, + 13, 229, 180, 14, 205, 16, 94, 90, 89, 91, 31, 157, 195, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 66, 111, 111, + 116, 82, 79, 77, 32, 102, 111, 114, 32, 88, 84, 77, 97, 120, 32, 118, + 49, 46, 48, 13, 10, 67, 111, 112, 121, 114, 105, 103, 104, 116, 32, 40, + 99, 41, 32, 50, 48, 50, 53, 32, 77, 97, 116, 116, 104, 105, 101, 117, + 32, 66, 117, 99, 99, 104, 105, 97, 110, 101, 114, 105, 13, 10, 0, 67, + 80, 85, 32, 115, 117, 112, 112, 111, 114, 116, 115, 32, 73, 78, 83, 47, + 79, 85, 84, 83, 32, 105, 110, 115, 116, 114, 117, 99, 116, 105, 111, 110, + 115, 13, 10, 0, 79, 108, 100, 32, 73, 78, 84, 49, 51, 104, 32, 86, + 101, 99, 116, 111, 114, 32, 61, 32, 0, 78, 101, 119, 32, 73, 78, 84, + 49, 51, 104, 32, 86, 101, 99, 116, 111, 114, 32, 61, 32, 0, 78, 101, + 119, 32, 70, 105, 120, 101, 100, 32, 68, 105, 115, 107, 32, 80, 97, 114, + 97, 109, 101, 116, 101, 114, 32, 84, 97, 98, 108, 101, 32, 61, 32, 0, + 83, 68, 32, 67, 97, 114, 100, 32, 105, 110, 105, 116, 105, 97, 108, 105, + 122, 101, 100, 32, 115, 117, 99, 99, 101, 115, 115, 102, 117, 108, 108, 121, + 13, 10, 0, 83, 68, 32, 67, 97, 114, 100, 32, 102, 97, 105, 108, 101, + 100, 32, 116, 111, 32, 105, 110, 105, 116, 105, 97, 108, 105, 122, 101, 13, + 10, 0, 85, 110, 115, 117, 112, 112, 111, 114, 116, 101, 100, 32, 73, 78, + 84, 49, 51, 104, 32, 70, 117, 110, 99, 116, 105, 111, 110, 32, 0, 58, + 0, 32, 0, 13, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -126,5 +127,4 @@ unsigned char BOOTROM[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; \ No newline at end of file + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104}; \ No newline at end of file diff --git a/XTMax/Drivers/BootROM/bootrom.asm b/XTMax/Drivers/BootROM/bootrom.asm index 9193cdc..6b3e2e5 100644 --- a/XTMax/Drivers/BootROM/bootrom.asm +++ b/XTMax/Drivers/BootROM/bootrom.asm @@ -473,16 +473,20 @@ func_02_read_sector: mov ax, wait_msg call print_string %endif - mov dx, XTMAX_IO_BASE+0 ; data port - mov cx, 50000 ; timeout (50ms) - jmp .receive_token_no_delay + mov dx, XTMAX_IO_BASE+15; timeout port + mov al, 10 ; 100 ms + out dx, al .receive_token: - call delay_us -.receive_token_no_delay: + mov dx, XTMAX_IO_BASE+0 ; data port in al, dx cmp al, 0xfe - loopne .receive_token - jne .error + je .got_token + mov dx, XTMAX_IO_BASE+15; timeout port + in al, dx + test al, al + jnz .error + jmp .receive_token +.got_token: %ifdef DEBUG_IO mov ax, sd_token_msg call print_string @@ -625,14 +629,20 @@ cpu 8086 mov ax, wait_msg call print_string %endif - mov cx, 50000 ; timeout (50ms) - jmp .receive_status_no_delay + mov dx, XTMAX_IO_BASE+15; timeout port + mov al, 25 ; 250 ms + out dx, al .receive_status: - call delay_us -.receive_status_no_delay: + mov dx, XTMAX_IO_BASE+0 ; data port in al, dx cmp al, 0xff - loope .receive_status + jne .got_status + mov dx, XTMAX_IO_BASE+15; timeout port + in al, dx + test al, al + jnz .error + jmp .receive_status +.got_status: %ifdef DEBUG_IO push ax mov ax, sd_status_msg @@ -652,15 +662,20 @@ cpu 8086 mov ax, wait_msg call print_string %endif - mov cx, 50000 ; timeout (50ms) - jmp .receive_finish_no_delay + mov dx, XTMAX_IO_BASE+15; timeout port + mov al, 25 ; 250 ms + out dx, al .receive_finish: - call delay_us -.receive_finish_no_delay: + mov dx, XTMAX_IO_BASE+0 ; data port in al, dx test al, al - loope .receive_finish - jz .error + jnz .got_finish + mov dx, XTMAX_IO_BASE+15; timeout port + in al, dx + test al, al + jnz .error + jmp .receive_finish +.got_finish: %ifdef DEBUG_IO mov ax, sd_idle_msg call print_string @@ -1118,21 +1133,6 @@ send_sd_read_write_cmd: ; General utilities ; -; -; Wait 1 microseconds. -; out: AX = -; FL = -delay_us: - push cx - push dx - xor cx, cx - mov dx, 1 ; microseconds - mov ah, 0x86 ; wait - int 0x15 - pop dx - pop cx - ret - %include "utils.inc" %ifdef DEBUG diff --git a/XTMax/Drivers/SDPP/HEADER.ASM b/XTMax/Drivers/SDPP/HEADER.ASM index 42925f6..c636c6b 100644 --- a/XTMax/Drivers/SDPP/HEADER.ASM +++ b/XTMax/Drivers/SDPP/HEADER.ASM @@ -129,7 +129,7 @@ _header DD -1 ; link to the next device DW DGROUP:STRATEGY ; address of the strategy routine DW DGROUP:INTERRUPT; " " " interrupt " DB 1 ; number of drives - DB 'SDCDv12' ; DOS doesn't really use these bytes + DB 'SDCDv13' ; DOS doesn't really use these bytes ; The geometry (sectors/track, tracks/cylinder) defined in the BPB is rather ; arbitrary in the case of the TU58, but there are things to watch out for. diff --git a/XTMax/Drivers/SDPP/SDMM.C b/XTMax/Drivers/SDPP/SDMM.C index a9408b3..c63309f 100644 --- a/XTMax/Drivers/SDPP/SDMM.C +++ b/XTMax/Drivers/SDPP/SDMM.C @@ -254,14 +254,13 @@ int wait_ready (void) /* 1:OK, 0:Timeout */ BYTE d; UINT tmr; - - for (tmr = 5000; tmr; tmr--) { /* Wait for ready in timeout of 500ms */ + outp(DATAPORT+15, 50); + do { /* Wait for ready in timeout of 500ms */ d = inp(DATAPORT); if (d == 0xFF) break; - dly_us(100); - } + } while(!inp(DATAPORT+15)); - return tmr ? 1 : 0; + return d == 0xFF; } @@ -310,11 +309,11 @@ int rcvr_datablock ( /* 1:OK, 0:Failed */ UINT tmr; - for (tmr = 1000; tmr; tmr--) { /* Wait for data packet in timeout of 100ms */ + outp(DATAPORT+15, 10); + do { /* Wait for data packet in timeout of 100ms */ d = inp(DATAPORT); if (d != 0xFF) break; - dly_us(100); - } + } while(!inp(DATAPORT+15)); if (d != 0xFE) { return 0; /* If not valid data token, return with error */ } diff --git a/XTMax/Drivers/XTSD.SYS b/XTMax/Drivers/XTSD.SYS index 2e90961..3333084 100644 Binary files a/XTMax/Drivers/XTSD.SYS and b/XTMax/Drivers/XTSD.SYS differ diff --git a/XTMax/Drivers/XTSD186.SYS b/XTMax/Drivers/XTSD186.SYS index ce5ae10..6047068 100644 Binary files a/XTMax/Drivers/XTSD186.SYS and b/XTMax/Drivers/XTSD186.SYS differ