Bochs仿真中不存在的段访问

时间:2016-07-20 17:14:21

标签: assembly x86-16 bochs

我正在编写一个启动加载程序,当我使用Bochs运行它时,我收到错误"不存在的段访问"。我找不到问题。 我的代码如下:

[bits 16]
[org 0x7c00]

%include 'include\disp.asm'

start:

    xor ax, ax
    mov ds, ax
    mov es, ax

    mov bx, 0x8000
    mov ss, bx
    mov sp, ax

    pushf
    stc

    ;reset floppy to point to chs - 0/0/1 or LBA 1
    reset_floppy:

        mov ah, 00
        int 13h

        floppy_read_sector:

            xor ax, ax
            mov es, ax       ;load the second sector to the address pointed
            mov bx, 0x1000   ;by [es:bx] - 0x0000:0x1000

            mov ah, 02       ;load the sub-function 2 of INT 13 to read sectors 
            mov al, 01       ;number of sectors to read       
            mov ch, 00       
            mov cl, 02       ;sector to start read from
            mov dh, 00       ;head number
            int 13h

            jc .floppy_read_sector_error

            popf
            ;jmp 0x0:0x1000   ;jump to address 0x1000 where we have loaded the second sector

            ;mov si, testd
            ;call ind_printf
            cli
            hlt

            .floppy_read_sector_error:

                ;mov si, sector_read_error
                ;call ind_printf

                cli
                hlt

data:

    sector_read_error db 'cannot read sector 0/0/2 from disk!',0x0A,0x0D,0
    testd db 'test',0

times 510-($-$$) db 0
dw 0xAA55

请帮我解决这个问题。

0 个答案:

没有答案