Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ucla-cs!sdcrdcf!psivax!csun!sdsu!m596008 From: m596008@sdsu.UUCP Newsgroups: comp.lang.pascal Subject: Re: Linking assembly with Turbo Pascal Message-ID: <2565@sdsu.UUCP> Date: Mon, 6-Apr-87 14:39:56 EST Article-I.D.: sdsu.2565 Posted: Mon Apr 6 14:39:56 1987 Date-Received: Sat, 11-Apr-87 00:25:48 EST References: <245@io.UUCP> Reply-To: m596008@sdsu.UUCP (Robotix Wizz!) Organization: San Diego State University, Math/Sciences Dept. Lines: 59 What follows is an example of a procedure call, and a function call. ------------------------------------------------------- For a procedure: procedure SET_CLOCK; external 'S_CLOCK.COM'; In the file 'S_CLOCK.COM' is the fully assembled code: code segment assume cs:code setclk proc near push ax push bx ; ; various code goes in here ; pop bx pop ax ret setclk endp code ends end ------------------------------------------------------ For a function: function TIME : integer; external 'SP_TIME.COM'; In the file 'SP_TIME.COM' is the assembled code: name sp_time include sm8086.mac pseg time1 dw ? public time time proc near push ss push ds push bp ; ; various code in here ; pop bp pop ds pop ss ret 2 time endp endps end Comments: The Turbo Tutor manual talks about this process on pages 22-3 to 22-6. When you pass parameters back to the caller from assembly, make sure your stack pointer is pointing to the return address when you execute the 'ret' instruction, and the parameters come after. John Falkenthal