From fae52a005736c3f9e2208f9b77905f780a7aa7d9 Mon Sep 17 00:00:00 2001 From: Matthieu Bucchianeri Date: Mon, 17 Feb 2025 00:09:52 -0800 Subject: [PATCH] Make the BootROM relocatable. --- XTMax/Code/XTMax/bootrom.h | 212 +++++++++++++++--------------- XTMax/Drivers/BootROM/bootrom.asm | 42 +++--- XTMax/Drivers/BootROM/diags.asm | 4 +- XTMax/Drivers/BootROM/utils.inc | 8 +- 4 files changed, 129 insertions(+), 137 deletions(-) diff --git a/XTMax/Code/XTMax/bootrom.h b/XTMax/Code/XTMax/bootrom.h index 4d2c9a9..9d625f4 100644 --- a/XTMax/Code/XTMax/bootrom.h +++ b/XTMax/Code/XTMax/bootrom.h @@ -1,113 +1,113 @@ #define BOOTROM_ADDR 0xce000 unsigned char BOOTROM[] = { - 85, 170, 4, 6, 80, 81, 82, 250, 184, 156, 5, 232, 2, 5, 232, 2, - 4, 115, 3, 233, 168, 0, 184, 222, 5, 232, 244, 4, 49, 192, 142, 192, - 38, 161, 78, 0, 186, 131, 2, 239, 232, 3, 5, 184, 149, 5, 232, 223, - 4, 38, 161, 76, 0, 186, 133, 2, 239, 232, 242, 4, 184, 153, 5, 232, - 206, 4, 184, 0, 206, 38, 163, 78, 0, 184, 196, 0, 38, 163, 76, 0, - 184, 59, 6, 232, 186, 4, 184, 64, 0, 142, 192, 38, 160, 117, 0, 4, - 128, 186, 130, 2, 238, 80, 232, 197, 4, 184, 153, 5, 232, 161, 4, 184, - 86, 6, 232, 155, 4, 38, 254, 6, 117, 0, 38, 160, 117, 0, 48, 228, - 232, 171, 4, 184, 153, 5, 232, 135, 4, 88, 49, 201, 142, 193, 60, 128, - 117, 16, 184, 0, 206, 38, 163, 6, 1, 184, 169, 1, 38, 163, 4, 1, - 235, 14, 184, 0, 206, 38, 163, 26, 1, 184, 169, 1, 38, 163, 24, 1, - 184, 0, 206, 38, 163, 98, 0, 184, 128, 3, 38, 163, 96, 0, 251, 90, - 89, 88, 7, 203, 251, 85, 86, 80, 82, 186, 130, 2, 236, 90, 56, 194, - 88, 116, 58, 137, 197, 137, 214, 156, 14, 184, 237, 0, 80, 186, 131, 2, - 237, 80, 186, 133, 2, 237, 80, 137, 232, 137, 242, 250, 203, 251, 156, 80, - 137, 240, 60, 128, 114, 19, 137, 232, 128, 252, 8, 117, 12, 6, 184, 64, - 0, 142, 192, 38, 138, 22, 117, 0, 7, 88, 157, 235, 58, 128, 252, 25, - 126, 5, 232, 122, 0, 235, 34, 128, 252, 1, 116, 10, 128, 252, 21, 116, - 5, 190, 57, 1, 235, 3, 190, 71, 1, 86, 137, 222, 136, 227, 48, 255, - 208, 227, 135, 222, 46, 255, 164, 91, 1, 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, 251, 202, 2, 0, 101, 3, 185, 1, 205, - 1, 97, 2, 38, 3, 143, 1, 143, 1, 143, 1, 65, 3, 101, 3, 143, - 1, 143, 1, 87, 3, 101, 3, 143, 1, 143, 1, 101, 3, 101, 3, 143, - 1, 143, 1, 101, 3, 103, 3, 143, 1, 143, 1, 143, 1, 101, 3, 80, - 184, 113, 6, 232, 122, 3, 88, 80, 136, 224, 48, 228, 232, 143, 3, 184, - 153, 5, 232, 107, 3, 88, 233, 203, 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, 160, 1, 80, 48, 228, 137, 198, 83, 232, 229, 1, 137, 197, 1, - 240, 137, 222, 131, 211, 0, 232, 12, 2, 91, 88, 115, 3, 233, 136, 1, - 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 184, 0, 206, 142, 216, 137, - 223, 186, 129, 2, 176, 0, 238, 81, 137, 232, 137, 243, 177, 81, 232, 215, + 85, 170, 4, 6, 80, 81, 82, 250, 184, 152, 5, 232, 0, 5, 184, 218, + 5, 232, 250, 4, 140, 200, 232, 18, 5, 184, 145, 5, 232, 239, 4, 184, + 0, 0, 232, 6, 5, 184, 149, 5, 232, 227, 4, 232, 228, 3, 115, 3, + 233, 140, 0, 49, 192, 142, 192, 38, 161, 78, 0, 186, 131, 2, 239, 38, + 161, 76, 0, 186, 133, 2, 239, 140, 200, 38, 163, 78, 0, 184, 197, 0, + 38, 163, 76, 0, 184, 55, 6, 232, 180, 4, 184, 64, 0, 142, 192, 38, + 160, 117, 0, 4, 128, 186, 130, 2, 238, 80, 232, 190, 4, 184, 149, 5, + 232, 155, 4, 184, 82, 6, 232, 149, 4, 38, 254, 6, 117, 0, 38, 160, + 117, 0, 48, 228, 232, 164, 4, 184, 149, 5, 232, 129, 4, 88, 49, 201, + 142, 193, 60, 128, 117, 15, 140, 200, 38, 163, 6, 1, 184, 170, 1, 38, + 163, 4, 1, 235, 13, 140, 200, 38, 163, 26, 1, 184, 170, 1, 38, 163, + 24, 1, 140, 200, 38, 163, 98, 0, 184, 127, 3, 38, 163, 96, 0, 251, + 90, 89, 88, 7, 203, 251, 85, 86, 80, 82, 186, 130, 2, 236, 90, 56, + 194, 88, 116, 58, 137, 197, 137, 214, 156, 14, 184, 238, 0, 80, 186, 131, + 2, 237, 80, 186, 133, 2, 237, 80, 137, 232, 137, 242, 250, 203, 251, 156, + 80, 137, 240, 60, 128, 114, 19, 137, 232, 128, 252, 8, 117, 12, 6, 184, + 64, 0, 142, 192, 38, 138, 22, 117, 0, 7, 88, 157, 235, 58, 128, 252, + 25, 126, 5, 232, 122, 0, 235, 34, 128, 252, 1, 116, 10, 128, 252, 21, + 116, 5, 190, 58, 1, 235, 3, 190, 72, 1, 86, 137, 222, 136, 227, 48, + 255, 208, 227, 135, 222, 46, 255, 164, 92, 1, 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, 251, 202, 2, 0, 100, 3, 186, 1, + 206, 1, 97, 2, 37, 3, 144, 1, 144, 1, 144, 1, 64, 3, 100, 3, + 144, 1, 144, 1, 86, 3, 100, 3, 144, 1, 144, 1, 100, 3, 100, 3, + 144, 1, 144, 1, 100, 3, 102, 3, 144, 1, 144, 1, 144, 1, 100, 3, + 80, 184, 109, 6, 232, 119, 3, 88, 80, 136, 224, 48, 228, 232, 139, 3, + 184, 149, 5, 232, 104, 3, 88, 233, 201, 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, 158, 1, 80, 48, 228, 137, 198, 83, 232, 227, 1, 137, 197, + 1, 240, 137, 222, 131, 211, 0, 232, 10, 2, 91, 88, 115, 3, 233, 134, + 1, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 140, 200, 142, 216, 137, + 223, 186, 129, 2, 176, 0, 238, 81, 137, 232, 137, 243, 177, 81, 232, 213, 2, 114, 60, 186, 135, 2, 176, 10, 238, 186, 128, 2, 236, 60, 254, 116, 10, 186, 135, 2, 236, 132, 192, 117, 38, 235, 238, 185, 0, 1, 86, 190, 0, 8, 252, 243, 165, 173, 94, 131, 197, 1, 131, 214, 0, 89, 226, 199, - 186, 129, 2, 176, 1, 238, 88, 95, 90, 89, 91, 31, 233, 45, 1, 186, - 129, 2, 176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 31, 233, 15, - 1, 132, 192, 117, 3, 233, 12, 1, 80, 48, 228, 137, 198, 83, 232, 81, - 1, 137, 197, 1, 240, 137, 222, 131, 211, 0, 232, 120, 1, 91, 88, 115, - 3, 233, 244, 0, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, - 140, 192, 142, 216, 184, 0, 206, 142, 192, 186, 129, 2, 176, 0, 238, 81, - 137, 232, 137, 243, 177, 88, 232, 63, 2, 114, 102, 186, 128, 2, 176, 254, - 238, 185, 0, 1, 86, 137, 254, 191, 0, 8, 252, 243, 165, 137, 247, 94, - 186, 135, 2, 176, 25, 238, 186, 128, 2, 236, 60, 255, 117, 10, 186, 135, - 2, 236, 132, 192, 117, 59, 235, 238, 36, 31, 60, 5, 117, 51, 186, 135, - 2, 176, 25, 238, 186, 128, 2, 236, 132, 192, 117, 10, 186, 135, 2, 236, - 132, 192, 117, 29, 235, 238, 131, 197, 1, 131, 214, 0, 89, 226, 160, 186, - 129, 2, 176, 1, 238, 140, 216, 142, 192, 88, 95, 90, 89, 91, 31, 235, - 107, 186, 129, 2, 176, 1, 238, 89, 140, 216, 142, 192, 88, 40, 200, 95, - 90, 89, 91, 31, 235, 74, 132, 192, 116, 74, 80, 48, 228, 137, 197, 83, - 232, 143, 0, 1, 232, 131, 211, 0, 232, 186, 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, 102, 0, 232, 150, 0, 91, - 88, 114, 21, 235, 23, 235, 21, 180, 3, 232, 160, 0, 135, 209, 248, 195, - 180, 170, 249, 195, 180, 1, 249, 195, 180, 4, 249, 195, 48, 228, 248, 195, - 49, 192, 142, 216, 142, 192, 185, 0, 1, 191, 0, 124, 243, 171, 186, 130, - 2, 236, 136, 194, 48, 246, 184, 1, 2, 185, 1, 0, 187, 0, 124, 205, - 19, 129, 62, 254, 125, 85, 170, 117, 15, 184, 142, 6, 232, 97, 1, 49, - 192, 142, 192, 234, 0, 124, 0, 0, 184, 168, 6, 232, 82, 1, 251, 244, - 235, 253, 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, 206, 142, 216, 186, 129, - 2, 176, 1, 238, 185, 1, 0, 186, 160, 134, 180, 134, 205, 21, 186, 128, - 2, 176, 255, 185, 10, 0, 238, 226, 253, 186, 129, 2, 176, 0, 238, 187, - 10, 0, 190, 208, 4, 185, 1, 0, 180, 1, 232, 92, 0, 115, 15, 49, - 201, 186, 32, 78, 180, 134, 205, 21, 75, 117, 231, 249, 235, 52, 190, 214, - 4, 185, 5, 0, 180, 1, 232, 64, 0, 114, 39, 186, 135, 2, 176, 250, - 238, 190, 220, 4, 185, 1, 0, 180, 1, 232, 45, 0, 190, 226, 4, 185, - 1, 0, 180, 0, 232, 34, 0, 115, 9, 186, 135, 2, 236, 132, 192, 116, - 224, 249, 94, 90, 89, 91, 31, 114, 8, 184, 249, 5, 232, 113, 0, 88, - 195, 184, 28, 6, 232, 105, 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, 238, 136, 248, 238, 136, 216, 238, 88, 134, 224, 238, 134, 224, 238, 176, - 1, 238, 185, 8, 0, 236, 60, 255, 225, 251, 132, 192, 116, 1, 249, 195, - 156, 30, 83, 86, 137, 198, 184, 0, 206, 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, 206, 142, 216, 49, 219, 252, 137, 214, - 177, 12, 211, 238, 131, 230, 15, 138, 132, 133, 5, 180, 14, 205, 16, 137, - 214, 177, 8, 211, 238, 131, 230, 15, 138, 132, 133, 5, 180, 14, 205, 16, - 137, 214, 177, 4, 211, 238, 131, 230, 15, 138, 132, 133, 5, 180, 14, 205, - 16, 137, 214, 131, 230, 15, 138, 132, 133, 5, 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, 58, 0, 32, 0, 13, 10, 0, 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, 79, 108, - 100, 32, 73, 78, 84, 49, 51, 104, 32, 86, 101, 99, 116, 111, 114, 32, - 32, 32, 32, 32, 32, 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, 70, 105, 120, 101, 100, - 32, 68, 105, 115, 107, 32, 73, 68, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 61, 32, 0, 84, 111, 116, 97, 108, 32, 70, 105, 120, 101, - 100, 32, 68, 105, 115, 107, 32, 68, 114, 105, 118, 101, 115, 32, 61, 32, - 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, 66, 111, - 111, 116, 105, 110, 103, 32, 102, 114, 111, 109, 32, 83, 68, 32, 67, 97, - 114, 100, 46, 46, 46, 13, 10, 0, 78, 111, 116, 32, 98, 111, 111, 116, - 97, 98, 108, 101, 13, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 186, 129, 2, 176, 1, 238, 88, 95, 90, 89, 91, 31, 233, 44, 1, 186, + 129, 2, 176, 1, 238, 89, 88, 40, 200, 95, 90, 89, 91, 31, 233, 14, + 1, 132, 192, 117, 3, 233, 11, 1, 80, 48, 228, 137, 198, 83, 232, 80, + 1, 137, 197, 1, 240, 137, 222, 131, 211, 0, 232, 119, 1, 91, 88, 115, + 3, 233, 243, 0, 30, 83, 81, 82, 87, 80, 137, 193, 48, 237, 137, 223, + 140, 192, 142, 216, 140, 200, 142, 192, 186, 129, 2, 176, 0, 238, 81, 137, + 232, 137, 243, 177, 88, 232, 62, 2, 114, 102, 186, 128, 2, 176, 254, 238, + 185, 0, 1, 86, 137, 254, 191, 0, 8, 252, 243, 165, 137, 247, 94, 186, + 135, 2, 176, 25, 238, 186, 128, 2, 236, 60, 255, 117, 10, 186, 135, 2, + 236, 132, 192, 117, 59, 235, 238, 36, 31, 60, 5, 117, 51, 186, 135, 2, + 176, 25, 238, 186, 128, 2, 236, 132, 192, 117, 10, 186, 135, 2, 236, 132, + 192, 117, 29, 235, 238, 131, 197, 1, 131, 214, 0, 89, 226, 160, 186, 129, + 2, 176, 1, 238, 140, 216, 142, 192, 88, 95, 90, 89, 91, 31, 235, 107, + 186, 129, 2, 176, 1, 238, 89, 140, 216, 142, 192, 88, 40, 200, 95, 90, + 89, 91, 31, 235, 74, 132, 192, 116, 74, 80, 48, 228, 137, 197, 83, 232, + 143, 0, 1, 232, 131, 211, 0, 232, 186, 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, 102, 0, 232, 150, 0, 91, 88, + 114, 21, 235, 23, 235, 21, 180, 3, 232, 160, 0, 135, 209, 248, 195, 180, + 170, 249, 195, 180, 1, 249, 195, 180, 4, 249, 195, 48, 228, 248, 195, 49, + 192, 142, 216, 142, 192, 185, 0, 1, 191, 0, 124, 243, 171, 186, 130, 2, + 236, 136, 194, 48, 246, 184, 1, 2, 185, 1, 0, 187, 0, 124, 205, 19, + 129, 62, 254, 125, 85, 170, 117, 15, 184, 138, 6, 232, 96, 1, 49, 192, + 142, 192, 234, 0, 124, 0, 0, 184, 164, 6, 232, 81, 1, 251, 244, 235, + 253, 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, 140, 200, 142, 216, 186, 129, 2, 176, + 1, 238, 185, 1, 0, 186, 160, 134, 180, 134, 205, 21, 186, 128, 2, 176, + 255, 185, 10, 0, 238, 226, 253, 186, 129, 2, 176, 0, 238, 187, 10, 0, + 190, 206, 4, 185, 1, 0, 180, 1, 232, 92, 0, 115, 15, 49, 201, 186, + 32, 78, 180, 134, 205, 21, 75, 117, 231, 249, 235, 52, 190, 212, 4, 185, + 5, 0, 180, 1, 232, 64, 0, 114, 39, 186, 135, 2, 176, 250, 238, 190, + 218, 4, 185, 1, 0, 180, 1, 232, 45, 0, 190, 224, 4, 185, 1, 0, + 180, 0, 232, 34, 0, 115, 9, 186, 135, 2, 236, 132, 192, 116, 224, 249, + 94, 90, 89, 91, 31, 114, 8, 184, 245, 5, 232, 113, 0, 88, 195, 184, + 24, 6, 232, 105, 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, 238, + 136, 248, 238, 136, 216, 238, 88, 134, 224, 238, 134, 224, 238, 176, 1, 238, + 185, 8, 0, 236, 60, 255, 225, 251, 132, 192, 116, 1, 249, 195, 156, 30, + 83, 86, 137, 198, 140, 200, 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, 140, 200, 142, 216, 49, 219, 252, 137, 214, 177, 12, 211, 238, + 131, 230, 15, 138, 132, 129, 5, 180, 14, 205, 16, 137, 214, 177, 8, 211, + 238, 131, 230, 15, 138, 132, 129, 5, 180, 14, 205, 16, 137, 214, 177, 4, + 211, 238, 131, 230, 15, 138, 132, 129, 5, 180, 14, 205, 16, 137, 214, 131, + 230, 15, 138, 132, 129, 5, 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, 58, 0, 32, 0, 13, 10, 0, 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, 82, 79, 77, 32, 66, 97, + 115, 101, 32, 65, 100, 100, 114, 101, 115, 115, 32, 32, 32, 32, 32, 32, + 32, 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, 70, 105, 120, 101, 100, 32, 68, 105, 115, + 107, 32, 73, 68, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 61, + 32, 0, 84, 111, 116, 97, 108, 32, 70, 105, 120, 101, 100, 32, 68, 105, + 115, 107, 32, 68, 114, 105, 118, 101, 115, 32, 61, 32, 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, 66, 111, 111, 116, 105, 110, + 103, 32, 102, 114, 111, 109, 32, 83, 68, 32, 67, 97, 114, 100, 46, 46, + 46, 13, 10, 0, 78, 111, 116, 32, 98, 111, 111, 116, 97, 98, 108, 101, + 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, 0, 0, 0, @@ -127,4 +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, 145}; \ No newline at end of file + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 189}; \ No newline at end of file diff --git a/XTMax/Drivers/BootROM/bootrom.asm b/XTMax/Drivers/BootROM/bootrom.asm index a320a01..407a0fc 100644 --- a/XTMax/Drivers/BootROM/bootrom.asm +++ b/XTMax/Drivers/BootROM/bootrom.asm @@ -59,6 +59,7 @@ cpu 8086 ; ensure we remain compatible with 8086 %error NUM_CYLINDERS_ is too large %endif +beginning_of_rom: %ifndef AS_COM_PROGRAM ; ; BIOS will look for the AA55 signature between C8000-DFFFF in 2KB increments. @@ -89,6 +90,17 @@ entry: mov ax, welcome_msg call print_string + mov ax, rom_base_msg + call print_string + mov ax, cs + call print_hex + mov ax, colon + call print_string + mov ax, beginning_of_rom + call print_hex + mov ax, newline + call print_string + ; ; Initialize the SD Card. ; @@ -102,23 +114,15 @@ entry: ; Install our BIOS INT13h hook into the interrupt vector table. ; .install_13h_vector: - mov ax, old_13h_msg - call print_string xor ax, ax ; INT vector segment mov es, ax mov ax, es:[0x13*4+2] mov dx, REG_SCRATCH_1 out dx, ax ; save segment - call print_hex - mov ax, colon - call print_string mov ax, es:[0x13*4] mov dx, REG_SCRATCH_3 out dx, ax ; save offset - call print_hex - mov ax, newline - call print_string - mov ax, ROM_SEGMENT + mov ax, cs mov es:[0x13*4+2], ax ; store segment mov ax, int13h_entry mov es:[0x13*4], ax ; store offset @@ -176,13 +180,13 @@ entry: mov es, cx cmp al, 0x80 jne .second_disk - mov ax, ROM_SEGMENT + mov ax, cs mov es:[0x41*4+2], ax ; store segment mov ax, fixed_disk_parameters_table mov es:[0x41*4+0], ax ; store offset jmp .end_fdpt .second_disk: - mov ax, ROM_SEGMENT + mov ax, cs mov es:[0x46*4+2], ax ; store segment mov ax, fixed_disk_parameters_table mov es:[0x46*4+0], ax ; store offset @@ -193,7 +197,7 @@ entry: ; Install our BIOS INT18h hook into the interrupt vector table. ; .install_18h_vector: - mov ax, ROM_SEGMENT + mov ax, cs mov es:[0x18*4+2], ax ; store segment mov ax, int18h_entry mov es:[0x18*4], ax ; store offset @@ -521,10 +525,8 @@ func_02_read_sector: push ax mov cx, ax ; number of sectors to read xor ch, ch -%ifndef AS_COM_PROGRAM - mov ax, ROM_SEGMENT + mov ax, cs mov ds, ax -%endif mov di, bx ; setup use of movsw .assert_cs: mov dx, REG_CS @@ -651,10 +653,8 @@ func_03_write_sector: mov di, bx ; destination address mov ax, es mov ds, ax ; save es and setup for movsw -%ifndef AS_COM_PROGRAM - mov ax, ROM_SEGMENT + mov ax, cs mov es, ax -%endif .assert_cs: mov dx, REG_CS mov al, 0 ; assert chip select @@ -1092,10 +1092,8 @@ init_sd: push cx push dx push si -%ifndef AS_COM_PROGRAM - mov ax, ROM_SEGMENT + mov ax, cs mov ds, ax -%endif mov dx, REG_CS mov al, 1 ; deassert chip select .power_up_delay: @@ -1309,7 +1307,7 @@ debug_handler: welcome_msg db 'BootROM for XTMax v1.0', 0xD, 0xA db 'Copyright (c) 2025 Matthieu Bucchianeri', 0xD, 0xA, 0 -old_13h_msg db 'Old INT13h Vector = ', 0 +rom_base_msg db 'ROM Base Address = ', 0 init_ok_msg db 'SD Card initialized successfully', 0xD, 0xA, 0 init_error_msg db 'SD Card failed to initialize', 0xD, 0xA, 0 disk_id_msg db 'Fixed Disk ID = ', 0 diff --git a/XTMax/Drivers/BootROM/diags.asm b/XTMax/Drivers/BootROM/diags.asm index d7c4cb9..ca9aee3 100644 --- a/XTMax/Drivers/BootROM/diags.asm +++ b/XTMax/Drivers/BootROM/diags.asm @@ -308,10 +308,8 @@ print_hex_byte: push si mov dl, al xor ah, ah -%ifndef AS_COM_PROGRAM - mov ax, ROM_SEGMENT + mov ax, cs mov ds, ax -%endif xor bx, bx cld .nibble1: diff --git a/XTMax/Drivers/BootROM/utils.inc b/XTMax/Drivers/BootROM/utils.inc index 38c4868..9824ff4 100644 --- a/XTMax/Drivers/BootROM/utils.inc +++ b/XTMax/Drivers/BootROM/utils.inc @@ -9,10 +9,8 @@ print_string: push bx push si mov si, ax -%ifndef AS_COM_PROGRAM - mov ax, ROM_SEGMENT + mov ax, cs mov ds, ax -%endif mov ah, 0xe xor bx, bx cld @@ -42,10 +40,8 @@ print_hex: push dx push si mov dx, ax -%ifndef AS_COM_PROGRAM - mov ax, ROM_SEGMENT + mov ax, cs mov ds, ax -%endif xor bx, bx cld .nibble1: