Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!MAINE.MAINE.EDU!michael From: michael@MAINE.MAINE.EDU (Michael Johnson) Newsgroups: comp.lang.asm370 Subject: Re: Extended parameter list Message-ID: <9002161629.AA03898@lilac.berkeley.edu> Date: 16 Feb 90 15:00:36 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: IBM 370 Assembly Programming Discussion List Distribution: inet Organization: The Internet Lines: 92 In article Wazawa Tetsuichi writes: > I wrote a test program using extended parameter list as bellow. But it >doesn't work. That is, the parameters I type on command line cannot be >referred by the module generated by the assembly source. Can anyone >point out what I mistake? > >Thanks in advance Tetsuichi Wazawa > Dept.of Science, Biological Institute > Tohoku University > >--------------------------- Cut Here ----------------------------------------- > >* > PRINT GEN > START 0 > STM 14,12,12(13) > BALR 12,0 > USING BEGIN,12 >* > LA 3,ADRCMD > MVC 0(4,3),0(0) > LA 3,ADRARST > MVC 0(4,3),4(0) > LA 3,ADRAREN > MVC 0(4,3),8(0) > L 3,ADRCMD > LA 4,BUF > MVC 0(8,4),0(3) > WRTERM BUF,8 > L 3,ADRARST > LA 4,BUF > MVC 0(30,4),0(3) > WRTERM BUF,30 > LM 14,12,12(13) > SR 15,15 > BR 14 >* >ADRCMD DS A >ADRARST DS A >ADRAREN DS A >BUF DC 80X'40' > END Try the following modification: PRINT GEN MY CSECT , USING MY,R12 STM R14,R12,12(R13) LR R12,R15 * LR R10,R0 Transfer EPLIST address USING EPLIST,R10 L R4,EPLCMD Find command token address WRTERM (R4),8 Write what is at that address L R4,EPLARGBG Get argument begin address L R3,EPLARGND And argument end address SLR R3,R4 Get length of arguments WRTERM (R4),(R3) Write them on the console LM R14,R12,12(R13) Restore caller's registers SR R15,R15 Set return and condition codes BR R14 Return to caller EPLIST END , The primary thing wrong with what you did was that you tried to use R0 as an address register. This is not possible. Any time R0 is used in an address calculation, the value of it is always assumed to be 0, regardless of what may actually be in it. There are reasons for this, and it can be handy to exploit this behavior. But you must watch out for it too. Similarly, when R0 is used as the register in an EXecute instruction, the value in it is also assumed to be 0, regardless of what may actually be in it. This makes it possible to execute an instruction remotely which you do not actually want to alter, without clearing a register first. R0 is generally used as the base for NUCON or (in CP) for PSA. This is because these dsects map the first page of (maybe virtual) storage and WANT to have a base address of 0. So USING NUCON,R0 gives you a base register for free, because you can use R0 for other things while also using it as NUCON base. Notice also in my changed example that it is NOT necessary to copy the values from the EPLIST before referencing them. You are not making any kind of call that requires CMS to build an EPLIST and so yours will remain uncorrupted. I hope this helps you. Michael Johnson "We are the Priests of the Temples University of Maine System of Syrinx. Our great computers fill Computing and Data Processing Services the hallowed halls." michael@maine.maine.edu -- Neil Peart