int 13h啊= 08h,我做错了什么?

时间:2012-01-24 15:15:06

标签: assembly operating-system nasm bootloader x86-16

好的,所以这是我的代码..

mov ah,08h
mov dl,80h ;have Tried for 81h,82h....
int 13h


mov ah,0Eh
    int 10h ;  printing the value in al.

int 10h在屏幕上打印ascii字符

启动后

结果总是“笑脸ascii字符”的一切,包括80h,81h,82h .. 输出屏幕在这里http://postimage.org/image/5twm1ml5j/ 对于啊= 0

,它为空

我在尝试之前将硬盘,usbs连接到我的笔记本电脑上......

我做错了什么?

使用qemu pc模拟器和nasm

这是我的全部代码。

    BITS 16

start:
mov ax, 1984    ; Set up 4K stack space after this bootloader
add ax, 288     ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096

mov ax, 1984        ; Set data segment to where we're loaded
mov ds, ax




mov ah,08h
mov dl,80h
int 13h


mov ah,0Eh
int 10h








times 510-($-$$) db 0   ; Pad remainder of boot sector with 0s
dw 0xAA55       ; The standard PC boot signature

2 个答案:

答案 0 :(得分:2)

你为什么要调用int 13h?那是磁盘服务,特别是啊= 08h你要求第一个驱动器的参数! (检查here) 然后你将所有的东西(肯定是these中的一个)移动到al,这是要打印的字符。打印的面是ascii char number 1,所以,再次查看here,你给int 13h提供了错误的参数。 ;)

答案 1 :(得分:0)

INT 13h AH=08h: Read Drive Parameters
Parameters:

Registers
AH  08h = function number for read_drive_parameters
DL  drive index (e.g. 1st HDD = 80h)
ES:DI[4]    set to 0000h:0000h to work around some buggy BIOS

Results:

CF  Set On Error, Clear If No Error
AH  Return Code
DL  number of hard disk drives
DH[4]   logical last index of heads = number_of - 1 (because index starts with 0)
CX  [7:6] [15:8][4] logical last index of cylinders = number_of - 1 (because index starts with 0)
[5:0][4] logical last index of sectors per track = number_of (because index starts with 1)

BL[4]   drive type (only AT/PS2 floppies)
ES:DI[4]    pointer to drive parameter table (only for floppies)

http://en.wikipedia.org/wiki/INT_13H