MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / writeBootSector

Function writeBootSector

tools/brother120tool.cc:103–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void writeBootSector(const Dirent& dirent, uint16_t checksum)
104{
105 uint8_t sslo = dirent.startSector & 0xff;
106 uint8_t sshi = dirent.startSector >> 8;
107 uint8_t scnt = dirent.sectorCount;
108 uint8_t end = 0x70 + scnt;
109 uint8_t cklo = checksum & 0xff;
110 uint8_t ckhi = checksum >> 8;
111
112 uint8_t machineCode[] = {
113 // clang-format off
114 /* 6000 */ 0x55, /* magic number? */
115 /* 6001 */ 0xf3, /* di */
116 /* 6002 */ 0x31, 0x00, 0x00, /* ld sp, $0000 */
117 /* 6005 */ 0x3e, 0x00, /* ld a, $00 */
118 /* 6007 */ 0xed, 0x39, 0x34, /* out0 ($34), a */
119 /* 600a */ 0x3e, 0x0f, /* ld a, $0f */
120 /* 600c */ 0xed, 0x39, 0x0a, /* out0 ($0a), a */
121 /* 600f */ 0x3e, 0x00, /* ld a,$00 */
122 /* 6011 */ 0xed, 0x39, 0xd8, /* out0 ($d8),a */
123 /* 6014 */ 0x3e, 0xe7, /* ld a,$e7 */
124 /* 6016 */ 0xed, 0x39, 0x3a, /* out0 ($3a),a */
125 /* 6019 */ 0x3e, 0x16, /* ld a,$16 */
126 /* 601b */ 0xed, 0x39, 0x38, /* out0 ($38),a */
127 /* 601e */ 0x3e, 0x20, /* ld a,$20 */
128 /* 6020 */ 0xed, 0x39, 0x39, /* out0 ($39),a */
129 /* 6023 */ 0x01, sslo, sshi, /* ld bc, start sector */
130 /* 6026 */ 0x21, 0x00, 0xf8, /* ld hl,$f800 */
131 /* 6029 */ 0x1e, scnt, /* ld e, sector count */
132 /* 602b */ 0x16, 0x70, /* ld d,$70 */
133 /* 602d */ 0xc5, /* push bc */
134 /* 602e */ 0xd5, /* push de */
135 /* 602f */ 0xe5, /* push hl */
136 /* 6030 */ 0x3e, 0x06, /* ld a,$06 */
137 /* 6032 */ 0xef, /* rst $28 */
138 /* 6033 */ 0xda, 0xd3, 0x60, /* jp c,$60d3 */
139 /* 6036 */ 0xe1, /* pop hl */
140 /* 6037 */ 0xd1, /* pop de */
141 /* 6038 */ 0xc1, /* pop bc */
142 /* 6039 */ 0x3e, 0x00, /* ld a,$00 */
143 /* 603b */ 0xed, 0x39, 0x20, /* out0 ($20),a */
144 /* 603e */ 0x3e, 0x58, /* ld a,$58 */
145 /* 6040 */ 0xed, 0x39, 0x21, /* out0 ($21),a */
146 /* 6043 */ 0x3e, 0x02, /* ld a,$02 */
147 /* 6045 */ 0xed, 0x39, 0x22, /* out0 ($22),a */
148 /* 6048 */ 0x3e, 0x00, /* ld a,$00 */
149 /* 604a */ 0xed, 0x39, 0x23, /* out0 ($23),a */
150 /* 604d */ 0x7a, /* ld a,d */
151 /* 604e */ 0xed, 0x39, 0x24, /* out0 ($24),a */
152 /* 6051 */ 0x3e, 0x02, /* ld a,$02 */
153 /* 6053 */ 0xed, 0x39, 0x25, /* out0 ($25),a */
154 /* 6056 */ 0x3e, 0x00, /* ld a,$00 */
155 /* 6058 */ 0xed, 0x39, 0x26, /* out0 ($26),a */
156 /* 605b */ 0x3e, 0x01, /* ld a,$01 */
157 /* 605d */ 0xed, 0x39, 0x27, /* out0 ($27),a */
158 /* 6060 */ 0x3e, 0x02, /* ld a,$02 */
159 /* 6062 */ 0xed, 0x39, 0x31, /* out0 ($31),a */
160 /* 6065 */ 0x3e, 0x40, /* ld a,$40 */

Callers 1

insertFileFunction · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected