1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Macros for memory mapped ATA controllers.
|
---|
3 |
|
---|
4 | %ifndef MEM_MAPPED_IDE_INC
|
---|
5 | %define MEM_MAPPED_IDE_INC
|
---|
6 |
|
---|
7 | JRIDE_SECTOR_ACCESS_WINDOW_OFFSET EQU 3C00h ; 512 byte IDE Sector Access Window
|
---|
8 | JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET EQU 3E00h ; 8 byte CS0 IDE Register Window
|
---|
9 | JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET EQU 3E08h ; 8 byte CS1 IDE Register Window
|
---|
10 | JRIDE_SECTOR_ACCESS_WINDOW_SIZE EQU 512 ; 512 bytes
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 | ;--------------------------------------------------------------------
|
---|
15 | ; OUTPUT_AL_TO_IDE_REGISTER_IN_DL
|
---|
16 | ; JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER_IN_DL
|
---|
17 | ; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER_IN_DL
|
---|
18 | ; Parameters:
|
---|
19 | ; AL: Byte to output
|
---|
20 | ; %1: IDE Register (OUTPUT_AL_TO_IDE_REGISTER)
|
---|
21 | ; IDE Control Block Register (OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER)
|
---|
22 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
23 | ; Returns:
|
---|
24 | ; Nothing
|
---|
25 | ; Corrupts registers:
|
---|
26 | ; BX, DX
|
---|
27 | ;--------------------------------------------------------------------
|
---|
28 | %unmacro OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
29 | %macro OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
30 | mov [cs:JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET+%1], al
|
---|
31 | %endmacro
|
---|
32 |
|
---|
33 | %unmacro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
34 | %macro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
|
---|
35 | OUTPUT_AL_TO_IDE_REGISTER %1
|
---|
36 | ret
|
---|
37 | %endmacro
|
---|
38 |
|
---|
39 | %unmacro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
|
---|
40 | %macro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
|
---|
41 | mov [cs:JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET+%1], al
|
---|
42 | %endmacro
|
---|
43 |
|
---|
44 |
|
---|
45 | ;--------------------------------------------------------------------
|
---|
46 | ; INPUT_TO_AL_FROM_IDE_REGISTER
|
---|
47 | ; JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER
|
---|
48 | ; Parameters:
|
---|
49 | ; %1: IDE Register
|
---|
50 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
51 | ; Returns:
|
---|
52 | ; AL: Inputted byte
|
---|
53 | ; Corrupts registers:
|
---|
54 | ; BX, DX
|
---|
55 | ;--------------------------------------------------------------------
|
---|
56 | %unmacro INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
57 | %macro INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
58 | mov al, [cs:JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET+%1]
|
---|
59 | %endmacro
|
---|
60 |
|
---|
61 | %unmacro JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
62 | %macro JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER 1
|
---|
63 | INPUT_TO_AL_FROM_IDE_REGISTER %1
|
---|
64 | ret
|
---|
65 | %endmacro
|
---|
66 |
|
---|
67 |
|
---|
68 | %endif ; MEM_MAPPED_IDE_INC
|
---|