Assembler! No, it’s not a language that Ikea has come up with. Assembly, asm, scary numbers language thingy or assembler, it has many names. This is there part where I tell you I haven’t written any asm but state that I’ve written some language that looks like it. Ehh… not this time.
This challenge is about… surprise surprise! Assembler!
IBM Z Mainframe Assembler
IBM Master the Mainframe Part Three – Challenge #13
This challenge sure won’t make me a full fledged Assembler programmer but I’ll at least have some experience with asm. Asm is more difficult to learn than other languages. It requires you to learn Assembler mnemonics, machine instructions, Assembler directives, Assembler macros and you need to know a thing or two about hardware architecture.
Being able to understand Assembler gives one the ability to debug complex system problems by reading system dumps. Higher level languages such as C/C++, Java, Cobol etc. were created to make programming the computer easier by hiding the complexity of the underlying machine instructions, addressable memory and registers.
Compile assembler program
Use TSO TEST facility to understand assembler program execution
Note, I will have to enter go numerous times to proceed with the program execution. It should stop at +42.
Modify and re-compile ASMPGM assembler program
- Use register 6 for all operations where register 2 was previously used
- Use register 7 for all operations where register 3 was previously used
- Initialize the register used to sum each add operation in the loop with a zero value
- Execute the loop 10 times adding 5 to the register being used to sum each add operation
Help! Can I pay someone to do this for me?
As for the registers 6 and 7, just change all occurrences where register 2 or 3 is used. In IBM’s explanation they state which register is being used at what line inside the code. So it’s a matter of understanding the code or just ctrl+f ‘register 2’ at mybluemix 😉
Initialise the register used to sum each add operation in the loop with a zero value is easy. Think how the two registeres are initialised now, they hold the value Begin. Then a bit further register 6 and 7 are ‘loaded‘ with value 4 and 1. I’ve only edited the one register where we add something. I didn’t touch the other register where we subtract from.
We can find the storage address of label LOOP at +3A, when we’ve entered go it adds 1 to register 3 until register 2 is zero as it subtracts one every loop. So in the end register 3 was 5 and register 2 held the value zero. How many times did we need to enter go in order to get register 2 to 0?
Think fast! IBM now wants us to execute the loop 10 times and add 5 every iteration to the register where we add a number.
I think I’ve got it right, now is a good time to debug again and tso submit ‘zos.public.jcl(p3ch13)’ to copy my code to P3.OUTPUT. Let’s debug first! Don’t make the same mistake I did, we’re debugging new registers now 🙂 not register 2 or 3. But 6 or 7.
Looks like it iterated 10 times all the way down to where register 6 equals zero and register 7 equals 0x32 (hex).
Should be it!