home *** CD-ROM | disk | FTP | other *** search
- ;-----------------------------------------------------------
- PAGE 66,128
- CSEG SEGMENT PARA PUBLIC 'CODE'
- ASSUME CS: CSEG
-
- ORG 100H ;Allow Boot-Sector as COM-File
- Begin: JMP SHORT Start ;Jump
- NOP
- bpb DB 3FH DUP (0) ;Reserve enough space for BPB
-
- Start PROC FAR
- ; mov ax,cs ;Get Code Segment
- ; cmp ax,7c00h ;Is it 7C00H
- ; jz tryboot ;Yes, Boot-Sector
- ; mov si,offset text3 ;Load Error Message
- ; call output ;Output text
- ; int 20h ;Terminate Program
- Tryboot: CLI ;Clear Interrupts, while modifying stack
- XOR AX,AX ;Zero AX
- MOV SS,AX ;Set SS...
- MOV SP,7C00H ;..and SP below Code
- MOV AX,7B0H ;Set Segment-Registers that Offset is 100H
- PUSH AX ;Push Segment twice
- PUSH AX
- POP DS ;Get Segment in DS
- POP ES ;and also in ES
- MOV SI,100H ;Set Source to 100H
- MOV DI,300H ;Set Destination to 300H
- MOV CX,100H ;Set Count to 512 Bytes (1 Sector)
- REP MOVSW ;Move Code
- MOV AX,7D0H ;New Segment at 7d0h (+20H)
- PUSH AX ;Push Segment three times
- PUSH AX
- PUSH AX
- POP DS ;Get new segment in DS
- POP ES ;and also in ES
- MOV AX,OFFSET Entry ;Offset of next instruction
- PUSH AX ;Push to stack
- RET ;and pop it to CS:IP
- Start ENDP
-
- Entry PROC FAR
- STI ;Start Interrupts again
- MOV SI,OFFSET Text1 ;Move SI to text
- CALL Output ;display to screen
- MOV AX,201H ;AH=2 (read sector), AL=1 (count)
- MOV CX,1 ;CH=0 (Track), CL=1 (Sector)
- MOV DX,128 ;DH=0 (Head), DL=128 (Fixed Disk C)
- XOR BX,BX ;Segment of Transfer buffer
- PUSH BX ;Push to Stack
- POP ES ;Get Segment in ES
- MOV BX,7C00H ;Offset of Transfer buffer
- PUSH ES ;Push Segment...
- PUSH BX ;And Offset to stack
- INT 13H ;Read from Harddisk
- JC Error ;Jump if error
- CMP WORD PTR ES:7DFEH,0AA55H ;Valid Boot Secotor?
- JNZ Error ;No, error
- RET ;Continue with Boot-Sector of C:
-
- Error: MOV SI,OFFSET Text2 ;Move SI to text
- CALL Output ;display to screen
- Loop1: MOV AH,1 ;Get Status of...
- INT 16H ;...Keyboard buffer
- JZ Boot_New ;if keypressed, reboot
- XOR AH,AH ;flush....
- INT 16H ;...Keyboard Buffer
- JMP Loop1 ;And try again
- Boot_New: XOR AH,AH ;flush...
- INT 16H ;...Keyboard buffer
- XOR DX,DX ;Zero DX
- INT 19H ;Reboot
- Entry ENDP
-
- Output PROC NEAR
- MOV AL,[SI] ;Get one character
- OR AL,AL ;Is it zero?
- JNZ Weiter ;No, continue
- RET ;else return
- Weiter: PUSH SI ;Save SI
- MOV AH,0EH ;Output character...
- INT 10H ;...in AL to screen
- POP SI ;restore SI
- INC SI ;Next character
- JMP SHORT Output ;repeat loop
- Output ENDP
-
-
-
- Text1 DB 'System wird von Platte geladen...', 0
- Text2 DB 13, 10, 'Kann nicht von der Festplatte starten.', 10, 13
- DB 'System-Diskette in Laufwerk A: einlegen', 10, 13
- DB 'dann eine Taste drücken.', 10, 13, 0
- Text3 DB 7 ,0
-
- ORG 2FDH
- CRCSum DB 0FFH
-
- ORG 2FEH
- DB 55H, 0AAH
-
- CSEG ENDS
- END Begin
-
- ;-----------------------------------------------------------
-
-