[400] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
| 2 | ; Description : Macros for normal I/O mapped ATA controllers.
|
---|
| 3 |
|
---|
| 4 | ;
|
---|
| 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
| 7 | ;
|
---|
| 8 | ; This program is free software; you can redistribute it and/or modify
|
---|
| 9 | ; it under the terms of the GNU General Public License as published by
|
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
| 11 | ; (at your option) any later version.
|
---|
| 12 | ;
|
---|
| 13 | ; This program is distributed in the hope that it will be useful,
|
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 16 | ; GNU General Public License for more details.
|
---|
| 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
| 19 |
|
---|
| 20 | %ifndef IDE_IO_INC
|
---|
| 21 | %define IDE_IO_INC
|
---|
| 22 |
|
---|
| 23 | JRIDE_SECTOR_ACCESS_WINDOW_OFFSET EQU 3C00h ; 512 byte IDE Sector Access Window
|
---|
| 24 | JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET EQU 3E00h ; 8 byte CS0 IDE Register Window
|
---|
| 25 | JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET EQU 3E08h ; 8 byte CS1 IDE Register Window
|
---|
| 26 | JRIDE_SECTOR_ACCESS_WINDOW_SIZE EQU 512 ; 512 bytes
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | ;--------------------------------------------------------------------
|
---|
| 30 | ; OUTPUT_AL_TO_IDE_REGISTER_IN_DL
|
---|
| 31 | ; JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER_IN_DL
|
---|
| 32 | ; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER_IN_DL
|
---|
| 33 | ; Parameters:
|
---|
| 34 | ; AL: Byte to output
|
---|
| 35 | ; %1: IDE Register (OUTPUT_AL_TO_IDE_REGISTER)
|
---|
| 36 | ; IDE Control Block Register (OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER)
|
---|
| 37 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
| 38 | ; Returns:
|
---|
| 39 | ; Nothing
|
---|
| 40 | ; Corrupts registers:
|
---|
| 41 | ; BX, DX
|
---|
| 42 | ;--------------------------------------------------------------------
|
---|
| 43 | %macro OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
| 44 | %ifnidni %1, dl
|
---|
| 45 | mov dl, %1
|
---|
| 46 | %endif
|
---|
| 47 | call IdeIO_OutputALtoIdeRegisterInDL
|
---|
| 48 | %endmacro
|
---|
| 49 |
|
---|
| 50 | %macro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
| 51 | %ifnidni %1, dl
|
---|
| 52 | mov dl, %1
|
---|
| 53 | %endif
|
---|
| 54 | jmp IdeIO_OutputALtoIdeRegisterInDL
|
---|
| 55 | %endmacro
|
---|
| 56 |
|
---|
| 57 | %macro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
|
---|
| 58 | %ifnidni %1, dl
|
---|
| 59 | mov dl, %1
|
---|
| 60 | %endif
|
---|
| 61 | call IdeIO_OutputALtoIdeControlBlockRegisterInDL
|
---|
| 62 | %endmacro
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | ;--------------------------------------------------------------------
|
---|
| 66 | ; INPUT_TO_AL_FROM_IDE_REGISTER
|
---|
| 67 | ; Parameters:
|
---|
| 68 | ; %1: IDE Register
|
---|
| 69 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
| 70 | ; Returns:
|
---|
| 71 | ; AL: Inputted byte
|
---|
| 72 | ; Corrupts registers:
|
---|
| 73 | ; BX, DX
|
---|
| 74 | ;--------------------------------------------------------------------
|
---|
| 75 | %macro INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
| 76 | %ifnidni %1, dl
|
---|
| 77 | mov dl, %1
|
---|
| 78 | %endif
|
---|
| 79 | call IdeIO_InputToALfromIdeRegisterInDL
|
---|
| 80 | %endmacro
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | %endif ; IDE_IO_INC
|
---|