1 | ; Project name : XTIDE Universal BIOS |
---|
2 | ; Description : Int 13h function AH=3h, Write Disk Sectors. |
---|
3 | |
---|
4 | ; Section containing code |
---|
5 | SECTION .text |
---|
6 | |
---|
7 | ;-------------------------------------------------------------------- |
---|
8 | ; Int 13h function AH=3h, Write Disk Sectors. |
---|
9 | ; |
---|
10 | ; AH3h_HandlerForWriteDiskSectors |
---|
11 | ; Parameters: |
---|
12 | ; AL, CX, DH, ES: Same as in INTPACK |
---|
13 | ; DL: Translated Drive number |
---|
14 | ; DS:DI: Ptr to DPT (in RAMVARS segment) |
---|
15 | ; SS:BP: Ptr to INTPACK |
---|
16 | ; Parameters on INTPACK in SS:BP: |
---|
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 | ; ES:BX: Pointer to source data |
---|
23 | ; Returns with INTPACK in SS:BP: |
---|
24 | ; AH: Int 13h/40h floppy return status |
---|
25 | ; CF: 0 if successfull, 1 if error |
---|
26 | ;-------------------------------------------------------------------- |
---|
27 | ALIGN JUMP_ALIGN |
---|
28 | AH3h_HandlerForWriteDiskSectors: |
---|
29 | test al, al ; Invalid sector count? |
---|
30 | jz SHORT AH2h_ZeroCntErr ; If so, return with error |
---|
31 | |
---|
32 | ; Select sector or block mode command |
---|
33 | mov ah, HCMD_WRITE_SECT ; Load sector mode command |
---|
34 | cmp BYTE [di+DPT.bSetBlock], 1 ; Block mode enabled? |
---|
35 | eCMOVA ah, HCMD_WRITE_MUL ; Load block mode command |
---|
36 | |
---|
37 | ; Transfer data |
---|
38 | call HCommand_OutputCountAndLCHSandCommand |
---|
39 | jc SHORT .ReturnWithErrorCodeInAH |
---|
40 | mov bx, [bp+INTPACK.bx] |
---|
41 | call HPIO_WriteBlock ; Write data to IDE-controller |
---|
42 | .ReturnWithErrorCodeInAH: |
---|
43 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|