jai@lab.ultra.nyu.edu (Benchiao Jai) (02/24/91)
public _get_base, _get_tot_mem _TEXT segment byte public 'CODE' assume cs:_TEXT _get_base: ; return click at which prog starts mov ax,ds ret _get_tot_mem: cli push es mov ax,9FFFh mov es,ax mov bx,0Eh mov ax,es:[bx] not ax mov es:[bx],ax cmp ax,es:[bx] jne L1 not ax mov es:[bx],ax mov ax,0A000h pop es sti ret L1: mov ax,8000h pop es sti ret ; See ../h/com.h for C definitions SEND = 1 RECEIVE = 2 BOTH = 3 SYSVEC = 32 ;*========================================================================* ; send and receive * ;*========================================================================* ; send(), receive(), sendrec() all save bp, but destroy ax, bx, and cx. public _send, _receive, _sendrec _sendrec: mov cx, BOTH ; sendrec(srcdest, ptr) L0: push bp ; save bp mov bp,sp ; can't index off sp mov ax,4[bp] ; ax = dest-src mov bx,6[bp] ; bx = message pointer int SYSVEC ; trap to the kernel pop bp ; restore bp ret ; return _send: mov cx, SEND ; send(dest, ptr) jmp L0 _receive: mov cx, RECEIVE ; receive(src, ptr) jmp L0 _TEXT ends end