pseudo.S 1.51 KB
Newer Older
1
;  pseudo.S  -  Produce a pseudo kernel header
2
;
3 4
;               Useful for booting arbitrary
;               binary images at 0x1000:0000
5
;
6 7 8 9 10 11
;  Copyright 2002-2005 John Coffman
;  Copyright 2009-2011 Joachim Wiedorn
;  All rights reserved.
;
;  Licensed under the terms contained in the file 'COPYING'
;  in the source directory.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
;

#define DEBUG 0
#define DELL_DIRTY_HACK


SYSSEG	=  0x1000	; DEF_SYSSEG
SETUPSEG = 0x9020	; DEF_SETUPSEG

CL_MAGIC_ADDR	= 0x20			! command line magic number
CL_MAGIC	= 0xa33f		! very unusual command sequence
CL_OFFSET	= 0x22			! command line offset
CL_LENGTH	= 256			! maximum length

		.text
#if 0
.globl	_main
_main:
#endif
		.globl	zero
zero:

; we want this to look like a bootable kernel image
; so we include the following header
;
		jmp	begin
		.ascii	"HdrS"		; looks like a real kernel
		.word	0x0200		; header format version number
		.word	0,0		; realmode switch, SETUPSEG
		.word	SYSSEG		; SYSSEG -- load at 1000:0000
		.word	id_string
		.byte	0		; type of loader
		.byte	0		; flags 0=load low
		.word	2*512		; move size: 2 sectors
		dd	0x10000		; load us here
		dd	0		; ramdisk image
		dd	0		; ramdisk size
		.word	bs_helper,SETUPSEG	; kludge???
;;		.word	modelist+1024	; heap end pointer
;----------end of header------------
		
begin:
	xor	di,di
	cmp	word ptr [CL_MAGIC_ADDR],#CL_MAGIC
	jne	gotoit
	mov	di,[CL_OFFSET]
gotoit:
	jmpi	0000,SYSSEG			; jmp to 0x1000:0000


bs_helper:      int     0x19			;label here for kludge


id_string:	.ascii	"pseudo.b"
		.byte	0

		.blkb	zero+512-*

modelist:

theend: