assembly - Trouble Reading Sectors off of CD INT 13h AH=42H -
I have a bootloader that is trying to write books off of a CD instead of a floppy and I start by Only the first area is to be read but when I run Carrie Flag is still set and according to the document from here: It means that it is unable to read the area from the image. Here's my complete boot code: / P> Edit: Obviously after I installed the drive number Forget forgot segments here: The function with the drive number will not work. I'm still new to this, so maybe someone else can explain it in depth? The BIOS number provides the drive closed it in the
bits 16 org 0 X00 Start: JMP Main; Define color for text% Teal 0x03% Definition Red 0x04% Definition Purple 0x05 COL: db 0 Row: db 0; Print% macro print 2 macro for XOR dx, dx mov dh byte [ROW]; Dh registers the line register xor bx, bx mov bl,% 2 mov c,% 1 call cprint mov ah, 0x02; Set cursor position mov bh, 0x00, page 00 dh; Line 00 mov dl, 0x00; Colonel 00 Intex 0x10 mov byte [ROU], DH; Next time we need to print% endmacro cprint by saving the rows:; Regular: output string in SI on screen .top: Parameter mov for input, ah, 09h; Color mov cx, 0x01; X position should be 9 to print the lodsb; Get the character from String Test Al, Al J. Don; If the four is zero, the end of string int 0x10; Otherwise, print it mov ah, 0x02; Set cursor position mov bh, 0x00; Page Ink DL; Column integer 0x10; The position of the cursor can therefore be changed to the new location JMP .top .done on the next four: Retired; Clears the screen and set the cursor position on the top left clear: mov ah, 0x0F; Get current video mode mov al, 0x00; Registered reset integer 0x10; Get video mode mov ah, 0x00; Set video mode integer 0x10; Reset screen mov ah, 0x02; Set cursor position mov bh, 0x00; Page 00 mov dh, 0x00; Line 00 mov dl, 0x00; Col 00 integer 0x10; Set Status Retired Read_Extended_Sector: Push XOR ax, ax xor dx, dx xor bx, bx; Read in the field .Loop: MOV DL, Byte [CDDriveNumber]; It is again Mov AH, 42H; Drive function read from MOV SI, disk address packet; Load with the address of the disk address packet SI INT 13h JNC .Success Print Read_Sector_Error_MSG, purple CLI hlt .Success: Print READ_SUCCESS, Teal CMP Ah, Stage2 JZ .DONE Print FILE_NOT_FOUND, Red CLI hlt .DONE: POPA Retired Chief: CLI ; Disabled comes in between mov ax, 0x07c0; Section adjustable registers mov ds, ax mov gs, ax mov fs, ax make_stack: xor ax, ax mov ess, ax mov ss, ax mov sp, 0x0fffe sti; Explain Interrupt Call Print W_MSG, TEAL; Color reads loading message in call Read_Extended_Sector; The first sector of the campaign reads; The data stored in the AH cd_signature is stored in: db "CD001" cd_Version: db 0x01 CDDriveNumber: db 80h; Disk Address Packet DiskAddressPacket: 16.0 db. SectorsToRead: 1dw; Number of areas to read (read OS Size). Offset: dw 0; Offset: 0000. Volume: dw 0200h; Segment 0200 Inter DQ16; Sector 16 or 10h CD-ROM at W_MSG: db "Load Z Boot ...........", 0 Stage2: db "Stage2 Bin" Read_Sector_Error_MSG: db "Failed to read the field ...... ", 0 READ_SUCCESS: DB" The first field was success reading ....... ", 0 FILE_NOT_FOUND: DB" error, file not found ....... "bar 2046 - ($ - $$) db 0 ; 0 DW 0xAA55 Padd out the rest of the file
Create_Stack: XOR ax, ax mov ess, ax mov ss, ax mov sp, 0x0fffe sti mov [CDDriveNumber], DL
DL register The drive is
00h is the first floppy drive, the drive is
01h second drive
80h is the first hard disk, and later follow the hard drive. When the CD-ROM is booted, and only when the CD-ROM is booted, the BIOS emits a CD-ROM such as it was a hard disk. This is the reason that you can use the
INT 13h, AX = 42 extended BIOS call to read it. The drive number that turns the BIOS emulated CD-ROM into the system from the system so you can not make it hard code.
Comments
Post a Comment