home *** CD-ROM | disk | FTP | other *** search
- ;; Special 386 macro file.
- P386
-
- ;; This macro is designed to replace a normal REP STOSB instruction
- ;; with a 386 version that will store as many long words as possible.
- ;; However, the entire EAX register will get trashed in this process.
- Macro RepStosb
- mov ah,al ; AH=AL
- push ax ; push word size of move
- push ax ; and again
- pop eax ; pop long word value of move
- push cx ; Save the total number of bytes to store
- shr cx,2 ; how many double words to move?
- rep stosd ; store this many long words.
- pop cx ; restore CX register.
- and cx,3 ; remaining number of bytes to move.
- rep stosb ; move the final bytes.
- endm
-
-
- Macro RepMovsb
- push cx
- shr cx,2 ; words.
- rep movsd
- pop cx
- and cx,3
- rep movsb
- endm
-
- ;; This macro replaces the LOOP instruction, because the loop instruction
- ;; is too damned slow on a 386/486
- macro CLOOP LABEL
- dec cx
- jnz LABEL
- endm
-
- macro CLODSB
- mov al,[ds:si]
- inc si
- endm
-
- macro CSTOSB
- mov [es:di],al
- inc di
- endm
-
- macro CLODSW
- mov ax,[ds:si]
- add si,2
- endm
-
- macro CSTOSW
- mov [es:di],ax
- add di,2
- endm
-
-
-