Eigener Bootloader — Änderungen 7461 → 7462

Zeile 35: Zeile 35:
 
Doch zuerst das wichtigste, was man über den MBR wissen sollte. Richtig, die Position und Struktur der Partitionstabelle. Aber die können wir hier im Lowlevel-Wiki nachschlagen.
 
Doch zuerst das wichtigste, was man über den MBR wissen sollte. Richtig, die Position und Struktur der Partitionstabelle. Aber die können wir hier im Lowlevel-Wiki nachschlagen.
  
−
Doch hier erst einmal etwas Starthilfe, ein MBR-Rohling.
+
Doch hier erst einmal etwas Starthilfe, ein MBR-Rohling:
  
 +
:''MBR.asm''
 
<asm>
 
<asm>
 
;; !! Intel-Syntax (MASN) !!
 
;; !! Intel-Syntax (MASN) !!
 +
  
 
;; Master-Boot-Record
 
;; Master-Boot-Record
 
;; ==================
 
;; ==================
 +
 +
 +
.model tiny, c, nearstack
 +
.386
 +
.code
 +
 +
 +
; ------------------------------------------------------------------------------
 +
; Struktur von CHS
 +
MBR_CHS struct
 +
    Value                  db      3 dup(?)
 +
MBR_CHS ends
 +
  
 
; Struktur der eines Partitionseintrages
 
; Struktur der eines Partitionseintrages
Zeile 47: Zeile 62:
 
     Bootflag                db      ?
 
     Bootflag                db      ?
  
−
     BeginHead              db      ?
+
     BeginCHS                MBR_CHS <>
−
     BeginCylinderHigh      db      ?
+
     EndCHS                  MBR_CHS <>      
−
    BeginCylinderLow        db      ?
+
−
 
 
−
    EndHead                db      ?
 
−
    EndCylinderHigh        db      ?
 
−
     EndCylinderLow          db      ?
 
−
 
 
 
     BeginLBA                dd      ?
 
     BeginLBA                dd      ?
 
     SizeLBA                dd      ?
 
     SizeLBA                dd      ?
 
MBR_PART_ENTRY ends
 
MBR_PART_ENTRY ends
−
 
+
 +
 
; Struktur der Partitionstabelle
 
; Struktur der Partitionstabelle
 
MBR_PART_TABLE struct
 
MBR_PART_TABLE struct
Zeile 66: Zeile 77:
 
     Partition4              MBR_PART_ENTRY <>
 
     Partition4              MBR_PART_ENTRY <>
 
MBR_PART_TABLE ends
 
MBR_PART_TABLE ends
−
 
+
−
 
+
 +
; ------------------------------------------------------------------------------
 
; MBR - Boot-Code
 
; MBR - Boot-Code
−
.org 0                 ; Offset 0x0
+
org 0                   ; Offset 0x0
  
 
;; << Hier kommt der Boot-Code rein >>
 
;; << Hier kommt der Boot-Code rein >>
−
 
+
−
 
+
 
; Partitionstabelle
 
; Partitionstabelle
−
.org 01BEh             ; Offset 0x01BE
+
org 01BEh               ; Offset 0x01BE
 
PartitionTable          MBR_PART_TABLE <>
 
PartitionTable          MBR_PART_TABLE <>
 +
 +
 +
; Boot-Signatur
 +
Sig                    dw      0AA55h      ; 0xAA55
  
  
−
; Boot-Signatur
+
end
−
Sig                    dw      0AA55h      ; 0xAA55
 
 
</asm>
 
</asm>