[148] | 1 | ; Project name : XTIDE Universal BIOS |
---|
[3] | 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: |
---|
[148] | 12 | ; AL, CX, DH, ES: Same as in INTPACK |
---|
| 13 | ; DL: Translated Drive number |
---|
| 14 | ; DS:DI: Ptr to DPT (in RAMVARS segment) |
---|
[150] | 15 | ; SS:BP: Ptr to IDEREGS_AND_INTPACK |
---|
| 16 | ; Parameters on INTPACK: |
---|
[3] | 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 |
---|
[150] | 23 | ; Returns with INTPACK: |
---|
[3] | 24 | ; AH: Int 13h/40h floppy return status |
---|
| 25 | ; CF: 0 if successfull, 1 if error |
---|
| 26 | ;-------------------------------------------------------------------- |
---|
| 27 | ALIGN JUMP_ALIGN |
---|
| 28 | AH3h_HandlerForWriteDiskSectors: |
---|
[158] | 29 | cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0 |
---|
| 30 | je SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero |
---|
| 31 | |
---|
[150] | 32 | mov ah, COMMAND_WRITE_SECTORS ; Load sector mode command |
---|
[158] | 33 | test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED |
---|
[150] | 34 | eCMOVNZ ah, COMMAND_WRITE_MULTIPLE ; Load block mode command |
---|
| 35 | mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) |
---|
| 36 | mov si, [bp+IDEPACK.intpack+INTPACK.bx] |
---|
| 37 | %ifdef USE_186 |
---|
| 38 | push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
| 39 | jmp Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH |
---|
| 40 | %else |
---|
| 41 | call Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH |
---|
[148] | 42 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
[150] | 43 | %endif |
---|