Trouble with assembler subroutines



High Level Assembler(HLASM) for MVS & VM & VSE

Re: Trouble with assembler subroutines

Postby enrico-sorichetti » Thu Nov 24, 2011 1:25 pm

follow on to a previous post
Some field testing shows SAV15 was used to prevent the message from disrupting what was in register 15, probably because of the nature of the subroutine.

no field test would have been needed, if You had read the manuals,
the comments about console and log contents were PROBLEM DETERMINATION
and the SAV15 stupp was the PROBLEM RESOLUTION

Stupid subroutines, they're not like higher level functions/methods... Oh well, my bad for expecting assembler to act like compiled code. An update is below:


well in assembler a program/subroutine is only as smart/stupid as the programmer writing them,
do not blame the innocent ones, You did everything by Yourself
strange that after so many posts You have not understood that assembler...
DOES ABSOLUTELY NOTHING FOR THE LOGIC AND YOU ARE IN CONTROL ALL THE TIME
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:50 am)
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Re: Trouble with assembler subroutines

 

Re: Trouble with assembler subroutines

Postby enrico-sorichetti » Thu Nov 24, 2011 1:54 pm

OMG ( Oh My God )... You are really thick as a brick

can You notice the different situation
between ( the initial SUMRTN code )
SUMRTN   DS      0H
         WTO 'NONSENSE'
         BR      15

the ( fixed SUMRTN code )
SUMRTN   DS      0H
         ST      15,sav15
         WTO 'NONSENSE FROM SUMRTN'
         L      15,sav15
         BR      15

and ( the last SUMRTN code )
SUMRTN   DS    0H
         ST    15,sav15
         AP    B,A
         AP    SUM,B
         L     15,sav15
         BR    15

just explain why You save R15 when it is not used inside SUMRTN ...


You must really change Your ways...
right now You are just picking instructions here and there and patch them together in the hope that something will work...
the above snippet sequence demonstrates it.... it is not the right way of doing things

with all the replies and suggestions You have received up to now in all the topics You started, You should have done a better job in understanding and doing things
unfortunately it is not so... we spent a lot of time explaining, posting snippets, links and excerpts from the manuals
but the results sadly do not correspond to the effort done from our side, meditate a bit on all Your TOPICS and review Your way of doing things
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:50 am)
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Trouble with assembler subroutines

Postby Robert Sample » Thu Nov 24, 2011 5:36 pm

enrico, there are "students" who simply won't learn -- they expect that by throwing enough random code pieces together they can get something to pass the class. I think we've found one of these "students". I, for one, will waste no further time on this waste of classroom space!

These users thanked the author Robert Sample for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:50 am)
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Trouble with assembler subroutines

Postby enrico-sorichetti » Thu Nov 24, 2011 5:43 pm

I think we've found one of these "students".

and this one even started complaining about the manners of people trying to help him ;)
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:50 am)
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Trouble with assembler subroutines

Postby RISCCISCInstSet » Fri Nov 25, 2011 3:21 am

Okay - I don't want to act like a cheater so -
Do you remember that? I was examining code and going out of my way to learn. I'm trying to pay more attention to previous posts (not with success I like - if that ticks you off jump in a lake)

Anyway it sounds like your community has had enough questions about subroutines, and I think I've gotten a reasonable amount of information, so this topic shall now be stopped. Thank all contributers for your help.

(BTW I am not a "waste of classroom space;" I try to learn; @enrico I thought flaming was against the rules - someone should clarify how the rules work here)
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with assembler subroutines

Postby enrico-sorichetti » Fri Nov 25, 2011 5:06 am

deleted
posted to the wrong forum
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:50 am)
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Trouble with assembler subroutines

Postby BillyBoyo » Fri Nov 25, 2011 6:28 am

RISCCISCInstSet wrote:Stupid subroutines, they're not like higher level functions/methods... Oh well, my bad for expecting assembler to act like compiled code. [,,,]


I think you need a bit of background reading on Assemblers in general.

A computer chip has an instruction set. Short of hand-producing the object-code, an assembler is the lowest level language you'll get. The language-elements are of a simple structure and "mnemonic" in nature. Writing in assembler is rigorous and unforgiving. And time-consuming. One assembler line, one instruction in the object-code. Macros are one of the things which make assembler bearable. The system macros, or your own, aid you in generating multiple instructions for standard pieces of work. Another thing is the ability to use sub-routines, either internal or even programs written in Assembler or other languages.

These days people don't generally decide to pick-up an Assembler language for fun. For those learning, the intention will generally be to use it for work purposes. Usually this would be with a formal course, backed-up by in-house training for the "local standards". That last is vital. More so that other languages, there are more ways than one to skin a cat in Assembler, you've been shown an example of this above. You can't (so easily) pick-and-choose - you have to learn all the basic things, and to know how to do the same thing in multiple different ways. Make sure you fully understand what Steve Myers was saying about the SR and the LA. You don't have to test the condition code immediately after the instruction which set it, but you don't want to blat it to something else before you do, so in the good-ole-POP note those that set the condition code and those that don't. Did you get a "yellow/green card"? This is your pocket reference for much that you will need to know, including knowing which instructions set the condition code.

At one site, your style (once you develop one) might fit in nicely, at 20 other sites, the way everybody else does it will be different, if you are not flexible, you will look like a "newbie" anyway.

It might help if we know your purpose in learning Assembler. Don't give a dumb answer, that won't help at all :-)

These users thanked the author BillyBoyo for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:50 am)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Trouble with assembler subroutines

Postby RISCCISCInstSet » Fri Nov 25, 2011 8:09 am

Program has been solved; I used a non-work register:
LAB6A    SUBENTRY
         
         LA     3,X'00000000'
         LA     4,X'00000001'
         LA     5,X'00000063'
         ZAP   B,=P'0'
         ZAP   SUM,=P'0'
         ZAP   A,=P'1'

LOOP     DS    0H
         BAL    6,SUMRTN
         BXLE  3,4,LOOP
         MVC  FIELD,MASK
         ED   FIELD,SUM
         WTO  MF=(E,WTOMSG)
         SUBEXIT

WTOMSG   DC AL2(WTOMEND-*,0)
HELLO    DC  C'THE SUM OF THE NUMBERS FROM 1 TO 100 IS '
FIELD    DS CL10
WTOMEND  EQU *

*
MASK     DC X'40206B2020206B202020'
PRNTLINE DS CL133
SUM      DS PL4
B        DS PL4
A        DS PL4
C        DS PL4
CB       DS PL4
DB       DS PL4


SUMRTN   DS      0H
         AP    B,A
         AP    SUM,B
         BR      6

ENDPGM   DS  D

    END  LAB6A
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with assembler subroutines

Postby RISCCISCInstSet » Fri Nov 25, 2011 9:23 am

Program has been solved; I used a non-work register:
Make that general purpose register.
RISCCISCInstSet
User avatar
RISCCISCInstSet
 
Posts: 121
Joined: Mon Oct 17, 2011 1:46 pm
Has thanked: 146 times
Been thanked: 0 time

Re: Trouble with assembler subroutines

Postby dick scherrer » Fri Nov 25, 2011 11:49 am

Hello,

Stupid subroutines, they're not like higher level functions/methods... Oh well, my bad for expecting assembler to act like compiled code.
Ah, Ummm, NO the subroutines are not stupid. . . They just don't work the way you want them to and, so far, you are still trying to get the "world" to change rather than following the more than 40 years evolution (which was "standard" more than 35 years ago. Why might you "expect" a green plant to act like a brown deer? Possibly i do not understand what you meant. . .

Do you remember that? I was examining code and going out of my way to learn.
What an oxymoron. If you are trying to learning new things, how can that be "out of your way".

I'm trying to pay more attention to previous posts (not with success I like - if that ticks you off jump in a lake)
Should have been your starting point - not somewher you finally stumboed to.

Anyway it sounds like your community has had enough questions about subroutines
No. We are quite happy to pursue properly presented questions/problems. We even go "out of our way to help the clueless" (as your drag-on topics demonstrate).

so this topic shall now be stopped.
Yes, it will - and not because of your request/demand/whine/rant/whatever.

Your future posts will be reviewed and none like this one will be tolerated again.

d

These users thanked the author dick scherrer for the post:
RISCCISCInstSet (Mon Nov 12, 2012 4:51 am)
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

PreviousNext

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post