source: xtideuniversalbios/trunk/Assembly_Library/Inc/Registers.inc@ 129

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

Changes to Assembly Library:

  • More optimizations to reduce size.
  • Removed some utility functions to reduce size.
File size: 1.5 KB
RevLine 
[105]1; Project name : Assembly Library
2; Description : Register related macros.
3%ifndef REGISTERS_INC
4%define REGISTERS_INC
5
6;--------------------------------------------------------------------
7; NORMALIZE_FAR_POINTER
8; Parameters:
9; %1:%2: Far pointer to normalize
10; %3: Scratch register
11; %4: Scratch register
12; Returns:
13; %1:%2: Normalized far pointer
14; Corrupts registers:
15; %3, %4
16;--------------------------------------------------------------------
17%macro NORMALIZE_FAR_POINTER 4
18 mov %4, %2 ; Copy offset to scratch reg
19 and %2, BYTE 0Fh ; Clear offset bits 15...4
20 eSHR_IM %4, 4 ; Divide offset by 16
21 mov %3, %1 ; Copy segment to scratch reg
22 add %3, %4 ; Add shifted offset to segment
23 mov %1, %3 ; Set normalized segment
24%endmacro
25
26
27;--------------------------------------------------------------------
28; COPY_SSBP_TO_ESDI
29; COPY_SSBP_TO_DSSI
30; COPY_DSSI_TO_ESDI
31; COPY_ESDI_to_DSSI
32; Parameters
33; Nothing
34; Returns:
35; Copies farm pointer to different segment/pointer register pair
36; Corrupts registers:
37; Nothing
38;--------------------------------------------------------------------
39%macro COPY_SSBP_TO_ESDI 0
40 push ss
41 pop es
42 mov di, bp
43%endmacro
44
45%macro COPY_SSBP_TO_DSSI 0
46 push ss
47 pop ds
48 mov si, bp
49%endmacro
50
51%macro COPY_DSSI_TO_ESDI 0
52 push ds
53 pop es
54 mov di, si
55%endmacro
56
57%macro COPY_ESDI_to_DSSI 0
58 push es
59 pop ds
60 mov si, di
61%endmacro
62
63
64
65%endif ; REGISTERS_INC
Note: See TracBrowser for help on using the repository browser.