1st try at floppy bootsector.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23480 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8e43ece8b8
commit
286edb37ca
@ -20,4 +20,8 @@
|
|||||||
|
|
||||||
#define ATARI_SHADOW_BASE 0xff000000
|
#define ATARI_SHADOW_BASE 0xff000000
|
||||||
|
|
||||||
|
/* how we will use it */
|
||||||
|
#define ATARI_ZBEOS_STACK_BASE 0x00008000
|
||||||
|
#define ATARI_ZBEOS_BASE 0x00010000 /* from .prg shell.S will copy itself there */
|
||||||
|
|
||||||
#endif /* ATARI_MEMORY_MAP_H */
|
#endif /* ATARI_MEMORY_MAP_H */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "atari_memory_map.h"
|
||||||
#include "toscalls.h"
|
#include "toscalls.h"
|
||||||
|
|
||||||
// 1 enabled verbose output
|
// 1 enabled verbose output
|
||||||
@ -36,6 +36,16 @@
|
|||||||
.text
|
.text
|
||||||
|
|
||||||
/* main entry point, both from the floppy boot and .prg */
|
/* main entry point, both from the floppy boot and .prg */
|
||||||
|
bra real_entry
|
||||||
|
|
||||||
|
sNumSectors:
|
||||||
|
// this location will contain the length of the boot loader as
|
||||||
|
// written by the "makeflop" command in 512 byte blocks
|
||||||
|
// 0x180 is the allowed maximum, as the zipped TAR with the
|
||||||
|
// kernel and the boot module might start at offset 192 kB
|
||||||
|
.word 0x0180
|
||||||
|
|
||||||
|
real_entry:
|
||||||
|
|
||||||
// first, determine if .prg (user) or bootsect (super)
|
// first, determine if .prg (user) or bootsect (super)
|
||||||
// Super()
|
// Super()
|
||||||
@ -49,6 +59,35 @@
|
|||||||
//bra bootsect_start
|
//bra bootsect_start
|
||||||
rts
|
rts
|
||||||
floppy_start:
|
floppy_start:
|
||||||
|
// no interrupt
|
||||||
|
and.w #0x0700,%sr
|
||||||
|
// setup stack
|
||||||
|
move.l #ATARI_ZBEOS_STACK_BASE,%sp
|
||||||
|
//XXX: check for enough RAM
|
||||||
|
// load the rest
|
||||||
|
move.w #sNumSectors,%d2
|
||||||
|
// load at base + this code.
|
||||||
|
move.l #ATARI_ZBEOS_BASE+512,%a2
|
||||||
|
bsr load_sectors
|
||||||
|
|
||||||
|
jmp #ATARI_ZBEOS_BASE+512
|
||||||
|
|
||||||
|
/** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx.
|
||||||
|
* The data is loaded to %a2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
load_sectors:
|
||||||
|
|
||||||
|
// Rwabs
|
||||||
|
move.w #0,-(%sp) // A:
|
||||||
|
move.w #1,-(%sp) // 2nd sector
|
||||||
|
move.w %d2,-(%sp)
|
||||||
|
move.l %a2,-(%sp)
|
||||||
|
move.w RW_,-(%sp)
|
||||||
|
move.w #4,-(%sp)
|
||||||
|
trap #13
|
||||||
|
add.l #14,%sp
|
||||||
|
rts
|
||||||
|
|
||||||
floppy_end:
|
floppy_end:
|
||||||
// .org FAILURE_STRING
|
// .org FAILURE_STRING
|
||||||
@ -71,7 +110,10 @@ prg_start:
|
|||||||
addq.l #6,%sp
|
addq.l #6,%sp
|
||||||
move.l %d0,saved_super_stack
|
move.l %d0,saved_super_stack
|
||||||
// all done
|
// all done
|
||||||
|
lea unimpl,%a0
|
||||||
|
jsr puts
|
||||||
|
prg_spin:
|
||||||
|
bra prg_spin
|
||||||
|
|
||||||
super_done:
|
super_done:
|
||||||
|
|
||||||
@ -93,6 +135,7 @@ GLOBAL(gBootPartitionOffset):
|
|||||||
|
|
||||||
|
|
||||||
lea.l str,%a0
|
lea.l str,%a0
|
||||||
|
puts:
|
||||||
.loopt:
|
.loopt:
|
||||||
move.b (%a0)+,%d0
|
move.b (%a0)+,%d0
|
||||||
beq .strout
|
beq .strout
|
||||||
@ -122,5 +165,6 @@ putc:
|
|||||||
movem.l (%sp)+,%a0
|
movem.l (%sp)+,%a0
|
||||||
rts
|
rts
|
||||||
str:
|
str:
|
||||||
.ascii "Haiku!"
|
.string "Haiku!"
|
||||||
.byte 0
|
unimpl:
|
||||||
|
.string "Unimplemented."
|
||||||
|
Loading…
Reference in New Issue
Block a user