🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.pascal
Article #166

Re: Error in Turbo-Pascal?

#166
From: Holtman Jim
Date: Fri, 05 Apr 1985 16:54
68 lines
2124 bytes
> 
> Hello folks,
> 
> is there anybody in net-land who is able to help me?
> the following program will not work, but why not?
> (TURBO-PASCAL V.2.0 on IBM-PC/XT)
> 
> >PROGRAM TEST;
> >type REGPACK = record
> >                  AX,BX,CX,DX,BP,SI,DI,DS,ES,FLAGS : integer;
> >               end;
> >var RECPACK : REGPACK;
> >procedure INTR_TEST;
> >begin
> >   inline($FB/$CF) {STI/IRET}
> >end;
> >begin
> >   RECPACK.AX := ($25 shl 8) + $50;
> >   RECPACK.DS := cseg;
> >   RECPACK.DX := ofs(INTR_TEST);
> >   intr($21,RECPACK);
> >   intr($50,RECPACK);
> >end.
> 
> The program starts correct, changes the interrupt-vector $50 to the address
> of INTR_TEST, then calls via INT the procedure INTR_TEST and executes it
> (until now nothing wrong), but after that the program hangs (no BREAK,
> no RESET will work, only POWER OFF/ON).
> 
> Helpfull hints to
> 
> Uwe Hoch
> University of Dortmund
> Computer Science Department(IRB)
> P.O. Box 500500
> D-4600 Dortmund 50
> West-Germany
> 
> via mail or uucp.
> 
> Thanks in advance!

The problem is not in TURBO, it is in you INLINE statement. If you
take a look at the code that is generated at INTR_TEST, you will
see the following:

	PUSH	BP
	MOV	BP,SP
	PUSH	BP
	JMP	L1
L1:	STI		; STATMENTS FROM inline
	IRET

What you have to do is to modify your INLINE to include the POPs
of 2 BPs; e.g.

     inline($FB/$5D/$5D/$CF)

which will generate the following:

	PUSH	BP
	MOV	BP,SP
	PUSH	BP
	JMP	L1
L1:	STI		; STATMENTS FROM inline
	POP	BP
	POP	BP
	IRET
Technical Details
Message-ID: <726@whuxlm.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!whuxlm!jph
References: <nf18500001@unido.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxlm.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!whuxlm!jph
From: jph@whuxlm.UUCP (Holtman Jim)
Newsgroups: net.lang.pascal
Subject: Re: Error in Turbo-Pascal?
Message-ID: <726@whuxlm.UUCP>
Date: Fri, 5-Apr-85 11:54:52 EST
Article-I.D.: whuxlm.726
Posted: Fri Apr  5 11:54:52 1985
Date-Received: Sat, 6-Apr-85 03:10:40 EST
References: <nf18500001@unido.UUCP>
Organization: AT&T Bell Laboratories, Whippany
Lines: 68