Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site smu.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!inuxc!pur-ee!uiucdcs!smu!faisal From: faisal@smu.UUCP Newsgroups: net.micro.pc Subject: Re: Help with PCDOS problem Message-ID: <15000012@smu.UUCP> Date: Sun, 21-Oct-84 12:23:00 EDT Article-I.D.: smu.15000012 Posted: Sun Oct 21 12:23:00 1984 Date-Received: Tue, 23-Oct-84 01:45:29 EDT References: <168@hocsl.UUCP> Lines: 61 Nf-ID: #R:hocsl:-16800:smu:15000012:000:2166 Nf-From: smu!faisal Oct 21 11:23:00 1984 <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> I now have an assembly language program whose entire script is: abc segment common xyz proc assume cs:abc,ds:abc ; int 20H ; don't do anything, just halt ; xyz endp abc ends end If I run it under DEBUG, it terminates normally. If I run it from a .BIN file (even right after a boot), the system hangs. It DOES compile OK, into the single interrupt instruction. I've done this on three different PCDOS machines, each with its own system disk. Same result each time. Does anybody out there know what I'm forgetting? Thanks in advance. Dave Tutelman <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> Response: Writing a one instruction program is a challenge. Int 20h is not a legal one instruction program. The problem is that when DOS loads your program, it changes CS to locate your int 20h, the first instruct. of your program, at CS:00; therefore, it MUST change CS. The DOS manual states that "Every program must ensure that the CS register contains the segment address of its Program Segment Prefix control block prior to issuing INT X'20'." In other words you need to change CS back before the int 20h instruction executes. There is NO way you can change your CS DIRECTLY, AND have the int 20h be the next instruction, AND have the computer run this int 10h... no way (you have to move things around and play tricks). Why resort to tricks when you can do it nicely and legally. Use this as the code: push DS ;save the segment of the PSP for this program xor ax,ax ;put 0 in ax push ax ;push this 0 on the stack on top of the PSP seg. . . . ; put your code here ret far ;return to the segment:offset specified by the words ; at [sp + 2]:[sp] This code saves the address of the PSP for itself on the stack, and when it is ready to terminate, it RETurns to this address, which happens to be the original CS:00. Guess what's at this address: int 20h (the legal way). Faisal Shah MicroLab CSE Dept. SMU Dallas, TX