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 "test1195.c"
- ?debug C E9A98CA24E0A74657374313139352E63
- _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
- _DATA segment word public 'DATA'
- _x label word
- db 100
- db 0
- _y label word
- db 200
- db 0
- _DATA ends
- _TEXT segment byte public 'CODE'
- ;
- ; void test()
- ;
- assume cs:_TEXT
- _test proc near
- push bp
- mov bp,sp
- ;
- ; {
- ; ptx=&x;
- ;
- mov word ptr DGROUP:_ptx+2,ds
- mov word ptr DGROUP:_ptx,offset DGROUP:_x
- ;
- ; pty=(int *)malloc(sizeof(int));
- ;
- mov ax,2
- push ax
- call near ptr _malloc
- pop cx
- cwd
- mov word ptr DGROUP:_pty+2,dx
- mov word ptr DGROUP:_pty,ax
- ;
- ; ptx=pty;
- ;
- mov ax,word ptr DGROUP:_pty+2
- mov dx,word ptr DGROUP:_pty
- mov word ptr DGROUP:_ptx+2,ax
- mov word ptr DGROUP:_ptx,dx
- ;
- ; }
- ;
- pop bp
- ret
- _test endp
- ;
- ; void test2()
- ;
- assume cs:_TEXT
- _test2 proc near
- push bp
- mov bp,sp
- ;
- ; {
- ; ptx=&x;
- ;
- mov word ptr DGROUP:_ptx+2,ds
- mov word ptr DGROUP:_ptx,offset DGROUP:_x
- ;
- ; pty=(int *)malloc(sizeof(int));
- ;
- mov ax,2
- push ax
- call near ptr _malloc
- pop cx
- cwd
- mov word ptr DGROUP:_pty+2,dx
- mov word ptr DGROUP:_pty,ax
- ;
- ; *ptx=*pty;
- ;
- les bx,dword ptr DGROUP:_pty
- mov ax,word ptr es:[bx]
- les bx,dword ptr DGROUP:_ptx
- mov word ptr es:[bx],ax
- ;
- ; }
- ;
- 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
- _TEXT ends
- _BSS segment word public 'BSS'
- _pty label dword
- db 4 dup (?)
- _ptx label dword
- db 4 dup (?)
- ?debug C E9
- _BSS 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
- public _pty
- public _ptx
- public _y
- public _x
- _s@ equ s@
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement