* checksum should be ok now...
* also added fake FAT descriptors to avoid crashing TOS, but it doesn't boot yet as floppy. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23525 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,13 +17,17 @@ int main(int argc, char **argv)
|
|||||||
perror("read");
|
perror("read");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (sum = 0, i = 0; i < (512-2); i++) {
|
for (sum = 0, i = 0; i < (512-2)/2; i++) {
|
||||||
sum += p[i];
|
uint16_t v;
|
||||||
|
v = *p++ << 8;
|
||||||
|
v += *p++;
|
||||||
|
sum += v;
|
||||||
}
|
}
|
||||||
sum = 0x1234 - sum;
|
sum = 0x1234 - sum + 1;
|
||||||
|
//sum = 0xaa55;
|
||||||
// big endian
|
// big endian
|
||||||
p[512-2] = (uint8_t)(sum >> 8);
|
*p++ = (uint8_t)(sum >> 8);
|
||||||
p[512-1] = (uint8_t)sum;
|
*p++ = (uint8_t)sum;
|
||||||
//lseek(fd, 0LL, SEEK_SET);
|
//lseek(fd, 0LL, SEEK_SET);
|
||||||
write(fd, §or[512-2], 2);
|
write(fd, §or[512-2], 2);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -19,6 +19,14 @@
|
|||||||
* the entry function of the embedded ELF part of the loader.
|
* the entry function of the embedded ELF part of the loader.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* generate boot floppy:
|
||||||
|
* cd src/system/boot/platform/atari_m68k/ ; make fixup_tos_floppy_chksum; cd -
|
||||||
|
* dd if=generated/objects/haiku/m68k/release/system/boot/zbeos of=~/floppy.img bs=512 count=20 conv=notrunc
|
||||||
|
* src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum ~/floppy.img
|
||||||
|
* generate .prg:
|
||||||
|
* generated.m68k/cross-tools/bin/m68k-unknown-haiku-ld -o haiku.prg -T src/system/boot/platform/atari_m68k/prg.ld generated/objects/haiku/m68k/release/system/boot/boot_loader_atari_m68k
|
||||||
|
*/
|
||||||
|
|
||||||
#include "atari_memory_map.h"
|
#include "atari_memory_map.h"
|
||||||
#include "toscalls.h"
|
#include "toscalls.h"
|
||||||
@@ -34,9 +42,36 @@
|
|||||||
// retry this many times until it will report a failure
|
// retry this many times until it will report a failure
|
||||||
|
|
||||||
//.text
|
//.text
|
||||||
|
_bs_entry:
|
||||||
/* main entry point, both from the floppy boot and .prg */
|
/* main entry point, both from the floppy boot and .prg */
|
||||||
bra real_entry
|
//bra.s skip_fat_skim
|
||||||
|
bra.s real_entry
|
||||||
|
//bra.s _bs_entry
|
||||||
|
//FAT lookalike to avoid nasty things from happening
|
||||||
|
// http://alive.atari.org/alive10/btmania.php
|
||||||
|
.ascii "Haiku0"
|
||||||
|
.byte 0xbe, 0x50, 0x38 // id
|
||||||
|
//LE
|
||||||
|
.byte 0x00, 0x02 //BPS
|
||||||
|
.byte 0x02 //SPC
|
||||||
|
//.byte 0x00 //???
|
||||||
|
.byte 0x00, 0x02 //RES - number of reserved sectors
|
||||||
|
.byte 0x00//0x02 //NFATS
|
||||||
|
.byte 0x00/*70*/, 0x00 //NDIRS
|
||||||
|
.byte 0x00, 0x02 //NSECTS
|
||||||
|
.byte 0xf8 //MEDIA
|
||||||
|
.byte 0x05, 0x00 //SPF
|
||||||
|
.byte 0x09, 0x00 //SPT
|
||||||
|
.byte 0x02, 0x00 //NSIDES
|
||||||
|
.byte 0x00, 0x00 //NHID
|
||||||
|
// we're done
|
||||||
|
|
||||||
|
skip_fat_skim:
|
||||||
|
// lea str,%a0
|
||||||
|
// bsr puts
|
||||||
|
// bra skip_fat_skim
|
||||||
|
//rts
|
||||||
|
// bra real_entry
|
||||||
|
|
||||||
sNumSectors:
|
sNumSectors:
|
||||||
// this location will contain the length of the boot loader as
|
// this location will contain the length of the boot loader as
|
||||||
@@ -47,6 +82,10 @@ sNumSectors:
|
|||||||
|
|
||||||
real_entry:
|
real_entry:
|
||||||
|
|
||||||
|
//Pterm0
|
||||||
|
//move.w #1,%d0
|
||||||
|
//trap #1
|
||||||
|
|
||||||
// first, determine if .prg (user) or bootsect (super)
|
// first, determine if .prg (user) or bootsect (super)
|
||||||
// Super()
|
// Super()
|
||||||
move.l #SUP_INQUIRE,-(%sp)
|
move.l #SUP_INQUIRE,-(%sp)
|
||||||
@@ -59,6 +98,9 @@ real_entry:
|
|||||||
//bra bootsect_start
|
//bra bootsect_start
|
||||||
rts
|
rts
|
||||||
floppy_start:
|
floppy_start:
|
||||||
|
lea str,%a0
|
||||||
|
bsr puts
|
||||||
|
bra floppy_start
|
||||||
// no interrupt
|
// no interrupt
|
||||||
and.w #0x0700,%sr
|
and.w #0x0700,%sr
|
||||||
// setup stack
|
// setup stack
|
||||||
@@ -122,7 +164,7 @@ prg_start:
|
|||||||
move.l %d0,saved_super_stack
|
move.l %d0,saved_super_stack
|
||||||
// all done
|
// all done
|
||||||
lea unimpl,%a0
|
lea unimpl,%a0
|
||||||
jsr puts
|
bsr puts
|
||||||
spin:
|
spin:
|
||||||
bra spin
|
bra spin
|
||||||
|
|
||||||
@@ -181,12 +223,12 @@ unimpl:
|
|||||||
.string "Unimplemented."
|
.string "Unimplemented."
|
||||||
|
|
||||||
shell_end:
|
shell_end:
|
||||||
.fill 0x01fe - tmp_floppy_end, 1, 0x55
|
//.fill (0x01fe - shell_end), 1, 0x55
|
||||||
// .org 0x01fe
|
.org 0x01fe
|
||||||
.word 0xaa55-1 // will be replaced by the one calculated by the build.
|
.word 0xaa55-1 // will be replaced by the one calculated by the build.
|
||||||
// we make sure we PCs don't try to execute it.
|
// we make sure we PCs don't try to execute it.
|
||||||
// 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
|
||||||
// XXX: actually TOS wants a real checksum here so sum is 0x1234!
|
// XXX: actually TOS wants a real checksum here so sum is 0x1234!
|
||||||
tmp_floppy_end:
|
|
||||||
|
|||||||
Reference in New Issue
Block a user