Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Archive » net.micro.pc » Help with PCDOS problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Help with PCDOS problem [message #79175] Sun, 02 June 2013 23:11 Go to next message
dmt is currently offline  dmt
Messages: 55
Registered: May 2013
Karma: 0
Member
Message-ID: <168@hocsl.UUCP>
Date: Fri, 12-Oct-84 21:58:32 EDT
Article-I.D.: hocsl.168
Posted: Fri Oct 12 21:58:32 1984
Date-Received: Wed, 17-Oct-84 05:38:54 EDT
Organization: AT&T Information Systems Labs, Holmdel NJ
Lines: 27

HELP! I thank those who suggested [unsuccessful] fixes
to my problem, but they didn't work. I have now narrowed it down
to, "I must be doing something very stupid; somebody please
set me straight."

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
Re: Help with PCDOS problem [message #80843 is a reply to message #79175] Tue, 04 June 2013 00:01 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: faisal@smu.UUCP
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
Re: Help with PCDOS problem [message #80852 is a reply to message #79175] Tue, 04 June 2013 00:01 Go to previous messageGo to next message
alan is currently offline  alan
Messages: 38
Registered: May 2013
Karma: 0
Member
Message-ID: <43@drivax.UUCP>
Date: Tue, 30-Oct-84 17:07:15 EDT
Article-I.D.: drivax.43
Posted: Tue Oct 30 17:07:15 1984
Date-Received: Fri, 26-Oct-84 03:06:06 EDT
References: <168@hocsl.UUCP>
Organization: Digital Research, Monterey
Lines: 17

Well, if you read the fine print in the DOS manual it says that
CS must point to the Program Segment Prefix when you execute the
Int 20. The only way that I know to do that is:

	xor	ax,ax
	push	ax
	push	ds
	ret

BTW: Just because you say 'assume ds:someware' don't make it so,
and DOS does not set cs and ds correctly for .com files, you have
to do it.
-- 
---------------------
Alan Fargusson.

{ ihnp4, sftig, amdahl, ucscc, ucbvax!unisoft }!drivax!alan
Re: Help with PCDOS problem [message #80860 is a reply to message #79175] Tue, 04 June 2013 00:01 Go to previous messageGo to next message
gino is currently offline  gino
Messages: 61
Registered: May 2013
Karma: 0
Member
Message-ID: <478@voder.UUCP>
Date: Fri, 26-Oct-84 18:47:08 EST
Article-I.D.: voder.478
Posted: Fri Oct 26 18:47:08 1984
Date-Received: Sun, 28-Oct-84 06:47:47 EST
References: <168@hocsl.UUCP>
Organization: National Semiconductor, Santa Clara
Lines: 38

 >>  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.
 >>  			Dave Tutelman

 >   BTW: Just because you say 'assume ds:someware' don't make it so,
 >   and DOS does not set cs and ds correctly for .com files, you have
 >   to do it.
 >   Alan Fargusson.

First, in response to Alan Fargusson:
    From the IBM DOS Technical Manual Version 2.10, page 6-8:
	"For .COM Programs:
	    All four segment registers contain the segment address of the
	    initial allocation block, that starts with the Program Segment
	    Prefix control block"

Back to the original question.  Since you can't execute a .bin file, Dave,
I suspect you actually executed a .exe file that you had left lying around.
That will hang.  Try these five things (they just worked for me 5 minutes ago):
    1.  Assemble whatever
    2.  Run exe2bin on whatever
    3.  DELETE whatever.exe
    4.  RENAME whatever.bin to whatever.com
    5.  whatever
-- 
Gene E. Bloch (...!nsc!voder!gino)
Re: Help with PCDOS problem [message #80883 is a reply to message #79175] Tue, 04 June 2013 00:01 Go to previous message
Anonymous
Karma:
Originally posted by: ericr@hpvcla.UUCP (ericr)
Message-ID: <10100001@hpvcla.UUCP>
Date: Sun, 28-Oct-84 04:29:00 EST
Article-I.D.: hpvcla.10100001
Posted: Sun Oct 28 04:29:00 1984
Date-Received: Tue, 30-Oct-84 20:28:05 EST
References: <168@hocsl.UUCP>
Organization: Hewlett-Packard - Vancouver, WA
Lines: 5
Nf-ID: #R:hocsl:-16800:hpvclc:10100001:000:182
Nf-From: hpvclc!ericr    Oct 21 21:29:00 1984



I didn't try this, but I believe that the lack of an explicit start 
point may be giving you trouble.  Change your 'end' statement to
'end xyz'.  This should set things straight.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Responses to 8086 query
Next Topic: [mlip@NADC (Michael Lipczynski): Transporting an XT]
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Mar 29 08:00:04 EDT 2024

Total time taken to generate the page: 0.08995 seconds