Created
May 4, 2014 15:17
-
-
Save antonijn/e2550be6e9b20437b89d to your computer and use it in GitHub Desktop.
_mul32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Multiplies two 32-bit numbers on 8086. | |
| */ | |
| long _stdcall _mul32(int highr, int lowr, int highl, int lowl) | |
| { | |
| asm { | |
| ; a = lowl * lowr | |
| mov ax, [bp + 6] ; lowl | |
| mul word [bp + 10] ; lowr | |
| mov bx, ax ; lowa in bx | |
| mov cx, dx ; higha in cx | |
| ; a += | |
| ; (lowl * highr) << 16 | |
| mov ax, [bp + 6] | |
| mul word [bp + 4] | |
| add cx, dx | |
| ; a += | |
| ; (highl * lowr) << 16 | |
| mov ax, [bp + 8] | |
| mul word [bp + 6] | |
| add cx, dx | |
| mov ax, bx | |
| mov dx, cx | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment