Scott Ford wrote:
Guys:
I have an Assembler routine below i want to call in C. I have changed it to be LE conforming.
GETSP231 START 0
GETSP231 AMODE 31
GETSP231 RMODE ANY
EDCPRLG BASEREG=R12,DSALEN=WORKLEN
USING LGINWORK,R13 SAVEAREA AND LOCAL VARS
*-------------------------------------------------------------
* LOADS STG AMOUNT INTO R9, STG ADDR INTO R10 AND RC IN R11
*-------------------------------------------------------------
LM R9,R11,4(R1) LOAD ADDRESS STG AMT, ADR & RC
L R9,0(R9) STG AMT - S/B 4K MULTIPLE
MODESET KEY=ZERO,MODE=SUP GO INTO SUPERVISOR MODE
STORAGE OBTAIN,LENGTH=(9),SP=231,LOC=ANY
ST R1,0(R5) RETURN ADDR, IF ANY
ST R15,0(R11) RETURN CODE, OK IF ZERO
MODESET KEY=NZERO,MODE=PROB BACK TO MORTALITY
*-------------------------------------------------------------
EDCEPIL
LTORG
LGINWORK EDCDSAD
WORKLEN EQU *-LGINWORK
YREGS
END GETSP231
In C is did this:
/*--------------------------------*/
#include <stdio.h>
#include <string.h>
#pragma linkage(GETSP231,OS)
int rc;
unsigned long int fullwd2;
char fullwd1[8];
main()
{
fullwd2 = 102400;
rc = GETSP231(&fullwd2,&fullwd1,&rc);
printf("Getsp231 rc: %d\n",rc);
if (rc == 0 )
{ printf("Getsp231 allocation worked\n");
printf("Allocation of: %d\n,",fullwd2);
printf("Allocation at: %s\n,",fullwd1);
}
else
{ printf("Getsp231 allocation failed\n");
}
}
I get a RC=0 which is great
Are you sure? Which rc is going to survive after
rc = GETSP231(&fullwd2,&fullwd1,&rc);
Bob
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN