stage2_ia_pc.asm

The stage 2 bootloader for My Operating System (MOS)

  • Loads and prepares stage 3
  • Loads and constructs all other files in the root directory into a ramdisk
  • Enables Gate A20
  • Determines memory map
  • Brings the system in a state similar to that of a multiboot loader

Author

Marcel Sondaar

License

Educational purposes

Summary
stage2_ia_pc.asmThe stage 2 bootloader for My Operating System (MOS)
Functions
DoneLoadprepare to boot mos86
GetDirClusterDX = directory entry
GetNextClusterGets the next cluster value from the FAT table
LoadClusterLoads a FAT cluster to RAM
LoadSectorLoads a sector (linear) from floppy to RAM
InitTextPosPrepares the screen for addressing
InitA20Enables A20 gate
InitA20testSets carry if A20 is enabled
InitGDTBuilds the bootstrap GDT
InitMemMapbuilds the memory map of this computer

Functions

DoneLoad

prepare to boot mos86

GetDirCluster

DX = directory entry

GetNextCluster

Gets the next cluster value from the FAT table

in

  • DX = current cluster number

out

  • DX = new cluster number

destroyed

ES AX BX CX

LoadCluster

Loads a FAT cluster to RAM

in

  • DX = clusternumber
  • FS = segment to load to

out

none

destroyed

ES AX BX CX SI DI

LoadSector

Loads a sector (linear) from floppy to RAM

in

  • DX = sectornumber
  • FS = segment to address

out

none

destroyed

ES AX BX CX SI DI

InitTextPos

Prepares the screen for addressing

InitA20

Enables A20 gate

InitA20test

Sets carry if A20 is enabled

InitGDT

Builds the bootstrap GDT

InitMemMap

builds the memory map of this computer