* Moved checksum to where it should be.
* Added tool to calculate the checksum (TOS wants a real one to 1234, not aa55). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23483 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <OS.h>
|
||||||
|
#include <ByteOrder.h>
|
||||||
|
|
||||||
|
|
||||||
|
uint8 sector[512];
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int fd, i;
|
||||||
|
uint16 sum;
|
||||||
|
uint16 *p = (uint16 *)sector;
|
||||||
|
fd = open(argv[1], O_RDWR);
|
||||||
|
if (fd < 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (read(fd, sector, 512-2) < 512) {
|
||||||
|
perror("read");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
for (sum = 0, i = 0; i < (512-2)/2; i++) {
|
||||||
|
sum += B_LENDIAN_TO_HOST_INT16(p[i]);
|
||||||
|
}
|
||||||
|
p[(512-2)/2] = B_HOST_TO_BENDIAN_INT16(0x1234 - sum);
|
||||||
|
//lseek(fd, 0LL, SEEK_SET);
|
||||||
|
write(fd, §or[512-2], 2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -69,7 +69,12 @@ floppy_start:
|
|||||||
// load at base + this code.
|
// load at base + this code.
|
||||||
move.l #ATARI_ZBEOS_BASE+512,%a2
|
move.l #ATARI_ZBEOS_BASE+512,%a2
|
||||||
bsr load_sectors
|
bsr load_sectors
|
||||||
|
tst.l %d0
|
||||||
|
beq floppy_done
|
||||||
|
lea failure_string,%a0
|
||||||
|
jsr puts
|
||||||
|
bra spin
|
||||||
|
flopy_done:
|
||||||
jmp #ATARI_ZBEOS_BASE+512
|
jmp #ATARI_ZBEOS_BASE+512
|
||||||
|
|
||||||
/** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx.
|
/** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx.
|
||||||
@@ -91,12 +96,16 @@ load_sectors:
|
|||||||
|
|
||||||
floppy_end:
|
floppy_end:
|
||||||
// .org FAILURE_STRING
|
// .org FAILURE_STRING
|
||||||
|
failure_string:
|
||||||
.string " Loading failed! Press key to reboot.\r\n"
|
.string " Loading failed! Press key to reboot.\r\n"
|
||||||
|
|
||||||
// .org DOT_STRING
|
// .org DOT_STRING
|
||||||
.string "."
|
.string "."
|
||||||
|
|
||||||
// .org 0x01fe
|
//shell_end:
|
||||||
.word 0xaa55
|
// .skip 0x01fe - tmp_floppy_end
|
||||||
|
//// .org 0x01fe
|
||||||
|
// .word 0xaa55
|
||||||
// this bumps the "start" label to offset 0x0200 as
|
// this bumps the "start" label to offset 0x0200 as
|
||||||
// expected by the BFS boot loader, and also marks
|
// expected by the BFS boot loader, and also marks
|
||||||
// this block as valid boot block for the BIOS
|
// this block as valid boot block for the BIOS
|
||||||
@@ -112,8 +121,8 @@ prg_start:
|
|||||||
// all done
|
// all done
|
||||||
lea unimpl,%a0
|
lea unimpl,%a0
|
||||||
jsr puts
|
jsr puts
|
||||||
prg_spin:
|
spin:
|
||||||
bra prg_spin
|
bra spin
|
||||||
|
|
||||||
super_done:
|
super_done:
|
||||||
|
|
||||||
@@ -168,3 +177,13 @@ str:
|
|||||||
.string "Haiku!"
|
.string "Haiku!"
|
||||||
unimpl:
|
unimpl:
|
||||||
.string "Unimplemented."
|
.string "Unimplemented."
|
||||||
|
|
||||||
|
shell_end:
|
||||||
|
.skip 0x01fe - tmp_floppy_end
|
||||||
|
// .org 0x01fe
|
||||||
|
.word 0xaa55-1 // will be replaced by the one calculated by the build.
|
||||||
|
// we make sure we PCs don't try to execute it.
|
||||||
|
// this bumps the "start" label to offset 0x0200 as
|
||||||
|
// expected by the BFS boot loader, and also marks
|
||||||
|
// this block as valid boot block for the BIOS
|
||||||
|
// XXX: actually TOS wants a real checksum here so sum is 0x1234!
|
||||||
|
|||||||
Reference in New Issue
Block a user