]> git.saurik.com Git - apple/boot.git/blob - i386/boot1/nullboot1.asm
boot-111.1.tar.gz
[apple/boot.git] / i386 / boot1 / nullboot1.asm
1 ; bootnot.asm - boot1 written for turbo assembler, since gas only
2 ; generates 32 bit code and this must run in real mode.
3 ; To compile as floppy boot1f.not:
4 ; tasm /m3 /dBOOTDEV=FLOPPY boot1 ,boot1f
5 ; tlink boot1f
6 ; exe2bin boot1f
7 ; ren boot1f.bin boot1f.not
8
9 ;***********************************************************************
10 ; This is the code for the NeXT boot1 bootsector.
11 ;***********************************************************************
12
13 P486 ;enable i386 instructions
14 IDEAL
15 SEGMENT CSEG
16 ASSUME CS:CSEG,DS:CSEG
17
18 SDEBUG = 0
19
20 ;BOOTSEG = 100h ; boot will be loaded at 4k
21 ;BOOTOFF = 0000h
22 BOOTSEG = 00h
23 BOOTOFF = 1000h
24 BUFSZ = 2000h ; 8K disk transfer buffer
25
26 ; This code is a replacement for boot1. It is loaded at 0x0:0x7c00
27
28 start:
29 mov ax,BOOTSEG
30 cli ; interrupts off
31 mov ss,ax ; set up stack seg
32 mov sp,0fff0h
33 sti ; reenable interrupts
34
35 xor ax,ax
36 mov es,ax
37 mov ds,ax
38 mov si,7C00h
39 cld ; so pointers will get updated
40 mov di,0E000h ; relocate boot program to 0xE000
41 mov cx,100h ; copy 256x2 bytes
42 repnz movsw ; move it
43 off1 = 0E000h + (a1 - start)
44 jmp FAR 0000:off1 ; jump to a1 in relocated place
45
46 a1:
47 mov ax,0E00h
48 mov ds,ax
49 mov ax,BOOTSEG
50 mov es,ax
51
52 mov si, OFFSET not_boot
53 call message ; display intro message
54
55 halt:
56 mov ah, 00h
57 int 16h
58 jmp halt ; get key and loop forever
59
60 message: ; write the error message in ds:esi
61 ; to console
62 push es
63 mov ax,ds
64 mov es,ax
65
66 mov bx, 1 ; bh=0, bl=1 (blue)
67 cld
68
69 nextb:
70 lodsb ; load a byte into al
71 cmp al, 0
72 je done
73 mov ah, 0eh ; bios int 10, function 0xe
74 int 10h ; bios display a byte in tty mode
75 jmp nextb
76 done: pop es
77 ret
78
79 putchr:
80 push bx
81 mov bx, 1 ; bh=0, bl=1 (blue)
82 mov ah, 0eh ; bios int 10, function 0xe
83 int 10h ; bios display a byte in tty mode
84 pop bx
85 ret
86
87
88 not_boot:
89 db 10,13
90 db 'The disk in the floppy disk drive isn''t a startup disk:'
91 db 10,13
92 db 'It doesn''t contain '
93 db 'the system files required to start up the computer.'
94 db 10,13
95 db 'Please eject this disk and restart the computer'
96 db ' with a floppy disk,'
97 db 10,13
98 db 'hard disk, or CD-ROM that is a startup disk.'
99 db 10,13
100 db 0
101
102 ; the last 2 bytes in the sector contain the signature
103 d1:
104 a2 = 510 - (d1 - start)
105 DB a2 dup (0)
106 DW 0AA55h
107 ENDS
108 END