NOP instruction
Posted: Wed Mar 14, 2012 6:02 am
Hi,
Trying to get myself more acquainted with bootloaders and x86 encoding/system programming. Am I correct in thinking that the use of a NOP before a OEM parameter block would be done so the first executed instruction was aligned to an even byte in memory?
I think I counted this correctly, with the OEM block being 41 bytes. If NOP was not there the first instruction executed would be 43 bytes after but is instead 44 bytes.
If not then any ideas? Reading the bootloader code from MikeOS which states:
Thanks,
Jim
Trying to get myself more acquainted with bootloaders and x86 encoding/system programming. Am I correct in thinking that the use of a NOP before a OEM parameter block would be done so the first executed instruction was aligned to an even byte in memory?
I think I counted this correctly, with the OEM block being 41 bytes. If NOP was not there the first instruction executed would be 43 bytes after but is instead 44 bytes.
If not then any ideas? Reading the bootloader code from MikeOS which states:
Code: Select all
jmp short bootloader_start ; Jump past disk description section
nop ; Pad out before disk description
OEMLabel db "MIKEBOOT" ; Disk label
BytesPerSector dw 512 ; Bytes per sector
SectorsPerCluster db 1 ; Sectors per cluster
ReservedForBoot dw 1 ; Reserved sectors for boot record
NumberOfFats db 2 ; Number of copies of the FAT
RootDirEntries dw 224 ; Number of entries in root dir
LogicalSectors dw 2880 ; Number of logical sectors
MediumByte db 0F0h ; Medium descriptor byte
SectorsPerFat dw 9 ; Sectors per FAT
SectorsPerTrack dw 18 ; Sectors per track (36/cylinder)
Sides dw 2 ; Number of sides/heads
HiddenSectors dd 0 ; Number of hidden sectors
LargeSectors dd 0 ; Number of LBA sectors
DriveNo dw 0 ; Drive No: 0
Signature db 41 ; Drive signature: 41 for floppy
VolumeID dd 00000000h ; Volume ID: any number
VolumeLabel db "MIKEOS "; Volume Label: any 11 chars
FileSystem db "FAT12 " ; File system type: don't change!
Jim