TAB1KAC@JPNTOHOK.BITNET (Wazawa Tetsuichi) (02/16/90)
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 ------------------------------------------ * ATE00010 PRINT GEN ATE00020 START 0 ATE00030 STM 14,12,12(13) ATE00040 BALR 12,0 ATE00050 USING BEGIN,12 ATE00060 * ATE00070 LA 3,ADRCMD ATE00080 MVC 0(4,3),0(0) ATE00090 LA 3,ADRARST ATE00100 MVC 0(4,3),4(0) ATE00110 LA 3,ADRAREN ATE00120 MVC 0(4,3),8(0) ATE00130 L 3,ADRCMD ATE00140 LA 4,BUF ATE00150 MVC 0(8,4),0(3) ATE00160 WRTERM BUF,8 ATE00170 L 3,ADRARST ATE00180 LA 4,BUF ATE00190 MVC 0(30,4),0(3) ATE00200 WRTERM BUF,30 ATE00210 LM 14,12,12(13) ATE00220 SR 15,15 ATE00230 BR 14 ATE00240 * ATE00250 ADRCMD DS A ATE00260 ADRARST DS A ATE00270 ADRAREN DS A ATE00280 BUF DC 80X'40' ATE00290 END ATE00300
SOMITCW@VCCSCENT.BITNET (02/16/90)
> 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? You cannot use register ZERO for addressing. Coding hints: 1. Use comments. 2. Use register equates ( macro REGEQU is on CMSLIB MACLIB ). 3. Delete sequence numbers. 4. Use START x'20000' or CSECT instead of START 0. 5. Use SAVE instead of STM ( the SAVE macro is on OSMACRO MACLIB ). 6. Use LR R12,R15 instead of BALR 12,0. 7. Use save areas. 8. Use just L instead of the LA, MVC, L sequence. * NOTOKEN CSECT , USING *,R15 TELL ASSEMBLER ABOUT THE TEMP. BASE SAVE (14,12),,NOTOKEN.&SYSDATE..&SYSTIME LA R12,SAVEAREA LOAD THE SAVE AREA ADDRESS ST R12,8(,R13) CONNECT SAVE AREAS ST R13,4(,R12) CONNECT SAVE AREAS LR R13,R12 CONNECT SAVE AREAS LR R12,R15 LOAD THE BASE REGITSER USING NOTOKEN,R12 TELL ASSEMBLER ABOUT THE BASE DROP R15 STOP USING THE TEMPORARY BASE LR R1,R0 FIX PARM-LIST ADDRESS TO BE ADDRESSED LM R2,R4,0(R1) LOAD PARM-LIST ADDRESSES ( WHY R4? ) * WRTERM (R2),8 DISPLAY THE START OF THE COMMAND WRTERM (R3),30 DISPLAY OPERANDS OF THE COMMAND * L R13,4(,R13) RESTORE CALLER'S R13 RETURN (14,12),RC=0 RETURN TO CALLER * SAVEAREA DC 18F'0' NON-RENT REGISTER SAVE AREA * REGEQU , REGISTER EQUATES * END ,
michael@MAINE.MAINE.EDU (Michael Johnson) (02/16/90)
In article <ASM370%90021600224921@OHSTVMA.BITNET> Wazawa Tetsuichi <TAB1KAC@JPNTOHOK.BITNET> 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