assembly - Jumping to second stage of bootloader -
I am working on a bootloader that closes a CD, and by now I have a lot of success in loading DAP Find, find the CD signature, and find the root directory. When I try to jump to the second stage address, the bootloader code will not execute the code, and I have no idea to fix it. Here is my code:
READ_STAGE2: print LOADING_STAGE2_MSG, teal phone Print_ln mov di, [DiskAddressPacket.offset] mov es, [DiskAddressPacket.Segment] XOR BX, BX, clears out bx XOR C, C; Ca xar cx, cx Removes: MOV AL, BYTE [ES: DI + BX]; A file entry CMP L drives a byte of a potential launch of BTE [STAGE2]; .request; If this then loops out of the INC BX; Get ready for the next file entry. Jmp .top .done: print found, print file gets print file X_RN XOR SI, SI; Bx; INC CE X-ray cx, cx; Clear for use as a counter .top2:; Comparing the stars to see if they are equal; Ax ax, ax; Clears ACX; MOV AL, BYTE [ES: DI + BX] MOV AH, 0xE INT 0x010; ;;;;;;;;;;;;;; 2 Bin; XOR AX, AX MOV AL, Byte [ES: DI + BX] CMP AL, Byte [Stage2 + SI] JE .Success Phone Print_ln JMP .top. Success: Print Progress_MSG, Purple, Progress Message Congress BX; Get ready for the next character Congress SI; Get ready for the next character INC CX; Salary increase counter CMP CX, Word [STAGE_2_LEN] jne .top2; Clear call phone Print_ln File_Found, teal print; Print found file print_ln print reading_Sectors, teal, mark reading marks of sector; Phone pronounced sub bx, word [STAGE_2_LEN]; Goes into DAP; MOV word [DiskAddressPacket.Offset], DI, MOV word [DiskAddressPacket.Segment], this Li EAX: add the BX to start the file back; The new address runs in ES; To say offset, [ES: DI] MOV DWORD [DiskAddressPacket.End], EAX MOV term [DiskAddressPacket.SectorsToRead], 4XOR cx, cx; How many fields call Read_Sectors to cx in 0x04, clears out cx mov cx, 0x01; Call READ_SUCCESS, TEAL; If it arrives here, it means that it has been successful, where the file is located and print it to run Print_ln print file_Found, TEAL call Print_ln MOV AX, ES call itova mov AL, ':' MOV AH, 0x ENT 0x010 MOV ax, call di Itoa print_ln; The obvious mov [jumptarget], the word de mov [jumptarget + 2], is called ES ES; JMP away [jumptarget] JMP 0x0200: 0x0000; PUSH 0x0200; PUSH 0x0000; Retf. Fail: failed to print, so that the file was not found and the system call was stopped Print_ln print FILE_NOT_FOUND, the red CLI HLT RT
Comments
Post a Comment