source: xtideuniversalbios/trunk/Assembly_Library/Src/Util/Registers.asm@ 208

Last change on this file since 208 was 207, checked in by gregli@…, 12 years ago

Added buffer pointer denormalization check within the serial port code and reused the last portion of the NormalizeESSI and NormalizeESDI routines to save memory.

File size: 2.5 KB
Line 
1; Project name : Assembly Library
2; Description : Functions for register operations.
3
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Registers_ExchangeDSSIwithESDI
10; Parameters
11; Nothing
12; Returns:
13; DS:SI and ES:DI are exchanged.
14; Corrupts registers:
15; Nothing
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18Registers_ExchangeDSSIwithESDI:
19 push ds
20 push es
21 pop ds
22 pop es
23 xchg si, di
24 ret
25
26
27;--------------------------------------------------------------------
28; Registers_CopySSBPtoESDI
29; Registers_CopySSBPtoDSSI
30; Registers_CopyDSSItoESDI
31; Registers_CopyESDItoDSSI
32; Parameters
33; Nothing
34; Returns:
35; Copies farm pointer to different segment/pointer register pair
36; Corrupts registers:
37; Nothing
38;--------------------------------------------------------------------
39ALIGN JUMP_ALIGN
40Registers_CopySSBPtoESDI:
41 COPY_SSBP_TO_ESDI
42 ret
43
44%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
45ALIGN JUMP_ALIGN
46Registers_CopySSBPtoDSSI:
47 COPY_SSBP_TO_DSSI
48 ret
49
50ALIGN JUMP_ALIGN
51Registers_CopyDSSItoESDI:
52 COPY_DSSI_TO_ESDI
53 ret
54
55ALIGN JUMP_ALIGN
56Registers_CopyESDItoDSSI:
57 COPY_ESDI_to_DSSI
58 ret
59%endif
60
61
62;--------------------------------------------------------------------
63; Registers_NormalizeESSI
64; Registers_NormalizeESDI
65; Parameters
66; DS:SI or ES:DI: Ptr to normalize
67; Returns:
68; DS:SI or ES:DI: Normalized pointer
69; Corrupts registers:
70; AX, CX
71;
72; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the
73; routine with Registers_NormalizeFinish.
74;
75;--------------------------------------------------------------------
76ALIGN JUMP_ALIGN
77Registers_NormalizeESSI:
78 mov cx, si
79 and si, byte 0fh
80 jmp Registers_NormalizeFinish
81
82ALIGN JUMP_ALIGN
83Registers_NormalizeESDI:
84 mov cx, di
85 and di, byte 0fh
86;;; fall-through
87
88ALIGN JUMP_ALIGN
89Registers_NormalizeFinish:
90 eSHR_IM cx, 4
91 mov ax, es
92 add ax, cx
93 mov es, ax
94 ret
95
96
97;--------------------------------------------------------------------
98; Registers_SetZFifNullPointerInDSSI (commented to save bytes)
99; Parameters
100; DS:SI: Far pointer
101; Returns:
102; ZF: Set if NULL pointer in DS:SI
103; Corrupts registers:
104; Nothing
105;--------------------------------------------------------------------
106;ALIGN JUMP_ALIGN
107;Registers_SetZFifNullPointerInDSSI:
108; push ax
109; mov ax, ds
110; or ax, si
111; pop ax
112; ret
Note: See TracBrowser for help on using the repository browser.