Changeset 592 in xtideuniversalbios for trunk/Assembly_Library/Src/Util/Memory.asm
- Timestamp:
- Jun 25, 2018, 10:29:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Util/Memory.asm
r580 r592 24 24 ; OPTIMIZE_STRING_OPERATION 25 25 ; Parameters 26 ; %1: Repeat instruction 27 ; %2: String instruction without size (for example MOVS and not MOVSB or MOVSW) 26 ; %1: String instruction without size (only MOVS and STOS is supported) 28 27 ; CX: Number of BYTEs to operate 29 ; DS:SI: Ptr to source data 28 ; DS:SI: Ptr to source data (for MOVS) 30 29 ; ES:DI: Ptr to destination 31 30 ; Returns: 31 ; CF: Cleared 32 ; CX: Zero 32 33 ; SI, DI: Updated by number of bytes operated 33 34 ; Corrupts registers: 34 35 ; Nothing 35 36 ;-------------------------------------------------------------------- 36 %macro OPTIMIZE_STRING_OPERATION 2 37 push cx 38 39 shr cx, 1 ; Operate with WORDs for performance 40 jz %%HandleRemainingByte 41 %1 %2w 42 %%HandleRemainingByte: 43 jnc SHORT %%OperationCompleted 44 %2b 45 46 ALIGN JUMP_ALIGN 47 %%OperationCompleted: 48 pop cx 37 %macro OPTIMIZE_STRING_OPERATION 1 38 shr cx, 1 39 rep %1w 40 eRCL_IM cx, 1 41 rep %1b 49 42 %endmacro 50 43 … … 57 50 ; ES:DI: Ptr to destination buffer 58 51 ; Returns: 52 ; CF: Cleared 59 53 ; SI, DI: Updated by number of bytes copied 60 54 ; Corrupts registers: 61 55 ; Nothing 62 56 ;-------------------------------------------------------------------- 63 %ifndef EXCLUDE_FROM_X TIDE_UNIVERSAL_BIOS57 %ifndef EXCLUDE_FROM_XUB 64 58 ALIGN JUMP_ALIGN 65 59 Memory_CopyCXbytesFromDSSItoESDI: 66 OPTIMIZE_STRING_OPERATION rep, movs 60 push cx 61 OPTIMIZE_STRING_OPERATION movs 62 pop cx 67 63 ret 68 64 %endif … … 77 73 ; Nothing 78 74 ; Corrupts registers: 79 ; Nothing75 ; CX 80 76 ;-------------------------------------------------------------------- 81 77 %ifdef INCLUDE_MENU_LIBRARY … … 102 98 ; DI: Updated by number of BYTEs stored 103 99 ; Corrupts registers: 104 ; AX 100 ; AX, CX 105 101 ;-------------------------------------------------------------------- 106 102 ALIGN JUMP_ALIGN … … 118 114 ; DI: Updated by number of BYTEs stored 119 115 ; Corrupts registers: 120 ; Nothing116 ; CX 121 117 ;-------------------------------------------------------------------- 122 ALIGN JUMP_ALIGN123 118 Memory_StoreCXbytesFromAccumToESDI: 124 OPTIMIZE_STRING_OPERATION rep,stos119 OPTIMIZE_STRING_OPERATION stos 125 120 ret 126 121 … … 135 130 ; AX 136 131 ;-------------------------------------------------------------------- 137 %ifndef EXCLUDE_FROM_X TIDE_UNIVERSAL_BIOS132 %ifndef EXCLUDE_FROM_XUB 138 133 ALIGN JUMP_ALIGN 139 134 Memory_ReserveCXbytesFromStackToDSSI:
Note:
See TracChangeset
for help on using the changeset viewer.