标签:
读取其它扇区数据:
org 0x7c00 jmp entry entry: mov ax,cs mov ds,ax mov es,ax mov ax,msg mov bp,ax mov cx,26 mov ax,0x1301 mov bx,000ch mov dl,0 int 10h ;读扇区:ah=02h mov ax,0x0820 mov es,ax mov ch,0 ;柱面 mov dh,0 ;磁头 mov cl,2 ;扇区 mov ah,0x02 mov al,1 ;扇区数 mov bx,0 ;ES:BX--缓冲区数据 mov dl,0x00 ;驱动器:00H~7FH软盘,80H~0FFH硬盘 int 0x13 msg db ‘This is program by myself!‘ times 510-($-$$) db 0 dw 0xaa55
拓展:
循环读取扇区数据
org 0x7c00 jmp entry entry: mov ax,cs mov ds,ax mov es,ax mov ax,msg mov bp,ax mov cx,26 mov ax,0x1301 mov bx,000ch mov dl,0 int 10h ;读扇区:ah=02h mov ax,0x0820 mov es,ax mov ch,0 ;柱面 mov dh,0 ;磁头 mov cl,2 ;扇区 readloop: mov ah,0x02 mov al,1 ;扇区数 mov bx,0 ;ES:BX--缓冲区数据 mov dl,0x00 ;驱动器:00H~7FH软盘,80H~0FFH硬盘 int 0x13 jnc next mov ax,0x00 mov dl,0x00 int 0x13 ;重置驱动器 jmp readloop next: mov ax,es add ax,0x20 mov es,ax inc cl cmp cl,18 ;最多读取18个扇区 jbe readloop msg db ‘This is program by myself!‘ times 510-($-$$) db 0 dw 0xaa55
标签:
原文地址:http://www.cnblogs.com/TnaHades/p/4925965.html