GetBootedCDStatus : MOV DL, Prepare to read CD-ROM, load boot drive MOV AH, 4Bh Use function 4Bh MOV AL, 1 MOV SI ,DiskResultsBuffer Results buffer to load INT 13h Call Check Extensions Present? JC Failure Need to engage the Failure Procedure MOV AH, 255 Load proposed error code (255 is our failure code for drive number miss detected) MOV DL, Load resultant drive information CMP ,DL Compare to see if they are the same (they should be) JNE Failure If they are not, Failure More information can be gathered here if needed later, not needed at this time. If the Function is successful, the carry flag is clear, else carry flag is set and AX register returns status code. This function is called first for "no emulation" booting of optical media. 0100 hard disk Other reserved 5-4 reserved (0) 6 image contains ATAPI driver 7 image contains SCSI driver(s) 02h db drive number 00h floppy image 80h bootable hard disk 81h-FFh nonbootable or no emulation drive 03h db CD-ROM controller number 04h dd Logical Block Address (LBA) of disk image to emulate 08h dw device specification (same as boot media type plus) (IDE) bit 0: Drive is slave instead of master (SCSI) bits 7-0: LUN and PUN bits 15-8: Bus number 0Ah dw segment of 3K buffer for caching CD-ROM reads 0Ch dw load segment for initial boot image (if 0000h, load at segment 07C0h only valid for INT 13h/AH=4Ch) 0Eh dw number of 512-byte virtual sectors to load (only valid for INT 13h/AH=4Ch) 10h db low byte of cylinder count (for INT 13/AH=08h) 11h db sector count, high bits of cylinder count (for INT 13h/AH=08h) 12h db head count (for INT 13h/AH=08h) Comments: The Function is used to get the status of the CD/DVD/BD. Get Status (Bootable CD-ROM) Call with: AX = 4B01H DL = Drive number DS:SI = Empty specification packet (needs to be 13h in size) Return: If Function Successful, Carry Flag = Clear If Function Unsuccessful, Carry Flag = Set AX = Status code DS:SI = Specification packet filled Offset Size Description 00h db size of packet in bytes (13h) 01h db boot media type Bit(s) Description 3-0 media type. Start Boot Procedure Begin : Begining of instructions CLI Turn off intterrupts mov ax, 0060h Boot Segment (no need to copy there) mov ds ,ax mov es ,ax MOV ,DL Save boot drive, right away MOV AX, 7000h MOV DS ,AX Segment of saved variables for SmiddyOS MOV BX, 530h Offset of boot drive saved variable MOV ,DL Save the boot drive for SmiddyOS use later MOV AX, 60h MOV DS ,AX Reset segment XOR AX ,AX Zero out the stack segment MOV SS ,AX MOV SP, 5FEh 0000:05FE MOV SP ,AX STI Turn interrupts back on MOV SI ,WelcomeMessage Tell everyone hello CALL PrintString Print the welcome message MOV SI ,TheEndOfTheLine Go to the next line CALL PrintString MOV AL, Load drive number in for comparison CMP AL, 0 Compare to known BAD drive number for CD/DVD/BD JE Failure If it is, it failed. format binary as "bin" Tell FASM to make an BIN image ORG 0DEBUG_MESSAGES : Comment out to remove debugging messagesBootSector : Label in order to determine size of code for padding at the end. Limitations include that the boot file needs to be in the root directory and the root directory can not be longer than one CD sector (2048 bytes). The loader expects to be booted at 0060:0000 (600h linear) and the bootable software gets loaded at 0202:0000 (2020h linear). Change the file name to one you wish to load instead. v1.00 - Beta release CD-ROM compatible booter, capable of booting bootable software, in this case SMIDDYOS.EXE. Filename : cdboot2.asm Assembler Command: Using FASMW IDE Useage: Using CDBOOT2.BIN as the boot loader from the created ISO from the CD-ROM creating CDROM.ASM from within FASMW IDE. Code: Project : smiddyOS (CD-ROM Booter) Author : smiddy Website : Date : Decem Quick Information: Compact Disc bootloader beta to load bootable software.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |