source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm@ 57

Last change on this file since 57 was 3, checked in by Tomi Tilli, 14 years ago
File size: 1.7 KB
Line 
1; File name : AH3h_HWrite.asm
2; Project name : IDE BIOS
3; Created date : 13.10.2007
4; Last update : 12.4.2010
5; Author : Tomi Tilli
6; Description : Int 13h function AH=3h, Write Disk Sectors.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; Int 13h function AH=3h, Write Disk Sectors.
13;
14; AH3h_HandlerForWriteDiskSectors
15; Parameters:
16; AH: Bios function 3h
17; AL: Number of sectors to write
18; CH: Cylinder number, bits 7...0
19; CL: Bits 7...6: Cylinder number bits 9 and 8
20; Bits 5...0: Starting sector number (1...63)
21; DH: Starting head number (0...255)
22; DL: Drive number (8xh)
23; ES:BX: Pointer to source data
24; Parameters loaded by Int13h_Jump:
25; DS: RAMVARS segment
26; Returns:
27; AH: Int 13h/40h floppy return status
28; CF: 0 if successfull, 1 if error
29; IF: 1
30; Corrupts registers:
31; Flags
32;--------------------------------------------------------------------
33ALIGN JUMP_ALIGN
34AH3h_HandlerForWriteDiskSectors:
35 test al, al ; Invalid sector count?
36 jz SHORT AH2h_ZeroCntErr ; If so, return with error
37
38 ; Save registers
39 push dx
40 push cx
41 push bx
42 push ax
43
44 ; Select sector or block mode command
45 call FindDPT_ForDriveNumber ; DS:DI now points to DPT
46 mov ah, HCMD_WRITE_SECT ; Load sector mode command
47 cmp BYTE [di+DPT.bSetBlock], 1 ; Block mode enabled?
48 jbe SHORT .XferData ; If not, jump to transfer
49 mov ah, HCMD_WRITE_MUL ; Load block mode command
50
51 ; Transfer data
52ALIGN JUMP_ALIGN
53.XferData:
54 call HCommand_OutputCountAndLCHSandCommand
55 jc SHORT .Return ; Return if error
56 call HPIO_WriteBlock ; Write data to IDE-controller
57.Return:
58 jmp Int13h_PopXRegsAndReturn
Note: See TracBrowser for help on using the repository browser.