source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc@ 199

Last change on this file since 199 was 152, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • XTIDE mod should now be supported (untested).
  • Interrupt Service Routine no longer requires variable from RAMVARS.
  • Some small improvements.
File size: 3.3 KB
RevLine 
[150]1; Project name : XTIDE Universal BIOS
[3]2; Description : Macros for accessing data port(s) on 8-bit
3; IDE controllers.
4%ifndef IDE_8BIT_INC
5%define IDE_8BIT_INC
6
7;--------------------------------------------------------------------
[152]8; Emulates INSW for XTIDE.
[3]9;
[152]10; XTIDE_INSW
[3]11; Parameters:
12; BX: Bit mask for toggling XTIDE data low/high reg
[152]13; DX: XTIDE Data Low Register address
[3]14; ES:DI: Ptr to destination buffer
15; Returns:
16; ES:DI: Incremented/decremented for next word
17; Corrupts registers:
18; AL, FLAGS
19;--------------------------------------------------------------------
[152]20%macro XTIDE_INSW 0
[3]21%ifdef USE_186 ; INS instruction available
22 insb ; Load low byte from port DX to [ES:DI]
23 xor dx, bx ; IDE Data Reg to XTIDE Data High Reg
24 insb ; Load high byte from port DX to [ES:DI]
25 xor dx, bx ; Restore to IDE Data Register
26%else ; If 8088/8086
27 in al, dx ; Load low byte from port
28 xor dx, bx ; IDE Data Reg to XTIDE Data High Reg
29 stosb ; Store byte to [ES:DI]
30 in al, dx ; Load high byte from port
31 xor dx, bx ; Restore to IDE Data Register
32 stosb ; Store byte to [ES:DI]
33%endif
34%endmacro
35
36
37;--------------------------------------------------------------------
[152]38; Emulates OUTSW for XTIDE.
[3]39;
[152]40; XTIDE_OUTSW
[3]41; Parameters:
42; BX: Bit mask for toggling XTIDE data low/high reg
[152]43; DX: XTIDE Data Low Register address
[3]44; DS:SI: Ptr to source buffer
45; Returns:
46; SI: Incremented/decremented for next word
47; Corrupts registers:
48; AX, FLAGS
49;--------------------------------------------------------------------
[152]50%macro XTIDE_OUTSW 0
[3]51%ifdef USE_186 ; OUTS instruction available
52 lodsb ; Load low byte from [DS:SI] to AL
53 xor dx, bx ; IDE Data Reg to XTIDE Data High Reg
54 outsb ; Output high byte from [DS:SI]
[152]55 xor dx, bx ; XTIDE Data High Reg to Data Low Reg
[3]56 out dx, al ; Output low byte from AL
57%else ; If 8088/8086
58 lodsw ; Load word from [DS:SI]
59 xor dx, bx ; IDE Data Reg to XTIDE Data High Reg
60 xchg al, ah ; => AL=high byte, AH=low byte
61 out dx, al ; Output high byte
[152]62 xor dx, bx ; XTIDE Data High Reg to Data Low Reg
[3]63 mov al, ah ; Copy low byte to AL
64 out dx, al ; Output low byte
65%endif
66%endmacro
67
68
[152]69;--------------------------------------------------------------------
70; Emulates OUTSW for modified XTIDE.
71;
72; XTIDE_MOD_OUTSW
73; Parameters:
74; DX: XTIDE Data Low Register address
75; DS:SI: Ptr to source buffer
76; Returns:
77; SI: Incremented/decremented for next word
78; Corrupts registers:
79; AX, FLAGS
80;--------------------------------------------------------------------
81%macro XTIDE_MOD_OUTSW 0
82%ifdef USE_186 ; OUTS instruction available
83 lodsb ; Load low byte from [DS:SI] to AL
84 inc dx ; IDE Data Reg to XTIDE MOD Data High Reg
85 outsb ; Output high byte from [DS:SI]
86 dec dx ; XTIDE Data High Reg to Data Low Reg
87 out dx, al ; Output low byte from AL
88%else ; If 8088/8086
89 lodsw ; Load word from [DS:SI]
90 inc dx ; IDE Data Reg to XTIDE MOD Data High Reg
91 xchg al, ah ; => AL=high byte, AH=low byte
92 out dx, al ; Output high byte
93 dec dx ; XTIDE Data High Reg to Data Low Reg
94 mov al, ah ; Copy low byte to AL
95 out dx, al ; Output low byte
96%endif
97%endmacro
98
99
[3]100%endif ; IDE_8BIT_INC
Note: See TracBrowser for help on using the repository browser.