1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Macros for memory 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 MEM_MAPPED_IDE_INC
|
---|
21 | %define MEM_MAPPED_IDE_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 | ;--------------------------------------------------------------------
|
---|
31 | ; OUTPUT_AL_TO_IDE_REGISTER_IN_DL
|
---|
32 | ; JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER_IN_DL
|
---|
33 | ; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER_IN_DL
|
---|
34 | ; Parameters:
|
---|
35 | ; AL: Byte to output
|
---|
36 | ; %1: IDE Register (OUTPUT_AL_TO_IDE_REGISTER)
|
---|
37 | ; IDE Control Block Register (OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER)
|
---|
38 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
39 | ; Returns:
|
---|
40 | ; Nothing
|
---|
41 | ; Corrupts registers:
|
---|
42 | ; BX, DX
|
---|
43 | ;--------------------------------------------------------------------
|
---|
44 | %unmacro OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
45 | %macro OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
46 | mov [cs:JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET+%1], al
|
---|
47 | %endmacro
|
---|
48 |
|
---|
49 | %unmacro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
50 | %macro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
51 | OUTPUT_AL_TO_IDE_REGISTER %1
|
---|
52 | ret
|
---|
53 | %endmacro
|
---|
54 |
|
---|
55 | %unmacro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
|
---|
56 | %macro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
|
---|
57 | mov [cs:JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET+%1], al
|
---|
58 | %endmacro
|
---|
59 |
|
---|
60 |
|
---|
61 | ;--------------------------------------------------------------------
|
---|
62 | ; INPUT_TO_AL_FROM_IDE_REGISTER
|
---|
63 | ; JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER
|
---|
64 | ; Parameters:
|
---|
65 | ; %1: IDE Register
|
---|
66 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
67 | ; Returns:
|
---|
68 | ; AL: Inputted byte
|
---|
69 | ; Corrupts registers:
|
---|
70 | ; BX, DX
|
---|
71 | ;--------------------------------------------------------------------
|
---|
72 | %unmacro INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
73 | %macro INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
74 | mov al, [cs:JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET+%1]
|
---|
75 | %endmacro
|
---|
76 |
|
---|
77 | %unmacro JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
78 | %macro JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
79 | INPUT_TO_AL_FROM_IDE_REGISTER %1
|
---|
80 | ret
|
---|
81 | %endmacro
|
---|
82 |
|
---|
83 |
|
---|
84 | %endif ; MEM_MAPPED_IDE_INC
|
---|