¹ØÓÚINT13H EXTµÄÊý¾Ý½á¹¹¼°²Ù×÷¼û£º http://zli.webspace4free.biz/page5.html
/** * Ó²Å̲Ù×÷£º"¶Á"²Ù×÷(0x42)£¬"д"²Ù×÷(0x43),\n * "cmd" must be Diskread(0x42) or Diskwrite(0x43). * @return >=0: ³É¹¦,¶ÁдµÄÊý¾Ý¿éÊý; * @return -1: ʧ°Ü. */ short _diskop (unsigned char drv, unsigned char cmd, unsigned char * buffer, unsigned long startlow, unsigned short copyblks) { /* ´ÅÅÌ´æÈ¡Êý¾Ý°ü½á¹¹ */ struct disk_address_packet { unsigned char size_of_packet; unsigned char reserved; unsigned short number_of_blocks_to_transfer; unsigned short transfer_buffer_offset; unsigned short transfer_buffer_segment; unsigned long starting_absolute_block_low; unsigned long starting_absolute_block_high; }; struct disk_address_packet dap; unsigned char av;
unsigned char * pt = (unsigned char *) &dap;
dap.size_of_packet = sizeof (dap); dap.reserved = 0; dap.number_of_blocks_to_transfer = copyblks; dap.transfer_buffer_offset = FP_OFF(buffer); dap.transfer_buffer_segment = FP_SEG(buffer); dap.starting_absolute_block_low = startlow; dap.starting_absolute_block_high = 0; /* ºöÂÔ¸ßλ */
asm { push ds push si mov ah, cmd mov dl, drv lds si, DWORD PTR pt int 13h pop si pop ds mov av, ah jc error } return (dap.number_of_blocks_to_transfer);
error: ErrorNum = av; return (-1); } |