Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ifndef ??version
- ?debug macro
- endm
- $comm macro name,dist,size,count
- comm dist name:BYTE:count*size
- endm
- else
- $comm macro name,dist,size,count
- comm dist name[size]:BYTE:count
- endm
- endif
- ?debug S "test1194.c"
- ?debug C E9B48CA24E0A74657374313139342E63
- _TEXT segment byte public 'CODE'
- _TEXT ends
- DGROUP group _DATA,_BSS
- assume cs:_TEXT,ds:DGROUP
- _DATA segment word public 'DATA'
- d@ label byte
- d@w label word
- _DATA ends
- _BSS segment word public 'BSS'
- b@ label byte
- b@w label word
- _BSS ends
- _TEXT segment byte public 'CODE'
- ;
- ; void test()
- ;
- assume cs:_TEXT
- _test proc near
- push bp
- mov bp,sp
- sub sp,12
- ;
- ; {
- ; int x=100, y=200;
- ;
- mov word ptr [bp-2],100
- mov word ptr [bp-4],200
- ;
- ; int far *ptx;
- ; int far *pty;
- ; ptx=&x;
- ;
- lea ax,word ptr [bp-2]
- mov word ptr [bp-6],ss
- mov word ptr [bp-8],ax
- ;
- ; pty=(int *)malloc(sizeof(int));
- ;
- mov ax,2
- push ax
- call near ptr _malloc
- pop cx
- cwd
- mov word ptr [bp-10],dx
- mov word ptr [bp-12],ax
- ;
- ; ptx=pty;
- ;
- mov ax,word ptr [bp-10]
- mov dx,word ptr [bp-12]
- mov word ptr [bp-6],ax
- mov word ptr [bp-8],dx
- ;
- ; }
- ;
- mov sp,bp
- pop bp
- ret
- _test endp
- ;
- ; void test2()
- ;
- assume cs:_TEXT
- _test2 proc near
- push bp
- mov bp,sp
- sub sp,12
- ;
- ; {
- ; int x=100, y=200;
- ;
- mov word ptr [bp-2],100
- mov word ptr [bp-4],200
- ;
- ; int far *ptx;
- ; int far *pty;
- ; ptx=&x;
- ;
- lea ax,word ptr [bp-2]
- mov word ptr [bp-6],ss
- mov word ptr [bp-8],ax
- ;
- ; pty=(int *)malloc(sizeof(int));
- ;
- mov ax,2
- push ax
- call near ptr _malloc
- pop cx
- cwd
- mov word ptr [bp-10],dx
- mov word ptr [bp-12],ax
- ;
- ; *ptx=*pty;
- ;
- les bx,dword ptr [bp-12]
- mov ax,word ptr es:[bx]
- les bx,dword ptr [bp-8]
- mov word ptr es:[bx],ax
- ;
- ; }
- ;
- mov sp,bp
- pop bp
- ret
- _test2 endp
- ;
- ; int main()
- ;
- assume cs:_TEXT
- _main proc near
- push bp
- mov bp,sp
- ;
- ; {
- ; return 0;
- ;
- xor ax,ax
- jmp short @3@58
- @3@58:
- ;
- ; }
- ;
- pop bp
- ret
- _main endp
- ?debug C E9
- _TEXT ends
- _DATA segment word public 'DATA'
- s@ label byte
- _DATA ends
- _TEXT segment byte public 'CODE'
- _TEXT ends
- public _main
- public _test2
- extrn _malloc:near
- public _test
- _s@ equ s@
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement