|
|
1.1 ! root 1: //////// ! 2: / ! 3: / Intel 8086 C runtime. ! 4: / SMALL model. ! 5: / ! 6: //////// ! 7: ! 8: .globl vlmul ! 9: .globl vrmul ! 10: ! 11: //////// ! 12: / ! 13: / unsigned long ! 14: / vrmul(a, b); ! 15: / unsigned long a; ! 16: / unsigned long b; ! 17: / ! 18: / unsigned long ! 19: / vlmul(a, p); ! 20: / unsigned long a; ! 21: / unsigned long *p; ! 22: / ! 23: / these two routines perform 32 bit unsigned multiplication. ! 24: / they are called by the compiler when a user program performs an ! 25: / unsigned long multiplication, and are called by the library routines ! 26: / that perform long multiplication. ! 27: / ! 28: //////// ! 29: ! 30: alow = 8 ! 31: ahigh = 10 ! 32: blow = 0 ! 33: bhigh = 2 ! 34: ! 35: vlmul: mov ax,bx / save bx ! 36: mov bx,sp / point bx at ! 37: mov bx,6(bx) / the operand and ! 38: jmp L0 / go to common end. ! 39: ! 40: vrmul: mov ax,bx / save bx ! 41: mov bx,sp / point bx at ! 42: lea bx,6(bx) / the operand. ! 43: ! 44: L0: push si / standard ! 45: push di / c ! 46: push bp / function ! 47: mov bp,sp / linkage. ! 48: ! 49: push ax / save saved bx. ! 50: mov ax,alow(bp) / multiply the low ! 51: mul blow(bx) / parts and ! 52: mov si,dx / stash both halves ! 53: mov di,ax / of the product. ! 54: ! 55: mov ax,alow(bp) / do the first of the ! 56: mul bhigh(bx) / cross products and ! 57: add si,ax / add it in. ! 58: ! 59: mov ax,ahigh(bp) / do the second of the ! 60: mul blow(bx) / cross products and ! 61: add si,ax / add it in. ! 62: ! 63: mov dx,si / get the return value ! 64: mov ax,di / into the proper registers. ! 65: ! 66: pop bx / restore saved bx. ! 67: mov sp,bp / standard ! 68: pop bp / c ! 69: pop di / function ! 70: pop si / linkage. ! 71: ret / done.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.