Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Assembly 

Assembler - 200 Class assignment, I'm so lost.

So I'm trying to learn assembler and I'm using z390 as an emulator(not my choice) and I'm having a great deal of difficulty. I was hoping for some help because I have ALOT of errors.

Here's the assignment:
[Image: i1YXC.png]

So I took the college try at it and got this:
Code
FIRST    CSECT
             BALR  12,0
             USING BASE,12
    * FIRST VOLUME BEING CALCULATED ------------------------
             L     R2,L1         STORE L1 IN REG 2.
             L     R3,W1         STORE W1 IN REG 3.
             L     R4,H1         STORE H1 IN REG 4.
             MR    R1,3          MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE CONTENTS IN REG 2.
             M     R1,H1         MUTIPLY CONTENTS OF REG 2. BY H1.    
             ST    R2,VOL1       STORE RESULT OF VOLUME IN VOL1.
    * SECOND VOLUME BEING CALCULATED ------------------------
             L     R2,L1         STORE L1 IN REG 2.(UNCHANGED FROM BEFORE)
             M     R1,DBL        DOUBLES REG 2. VALUE
             ST    R2,L2         STORE DOUBLED LENGTH IN L2
             M     R2,DBL        DOUBLES REG 3. VALUE
             ST    R3,W2         STORE DOUBLED WIDTH IN W2
             M     R3,DBL        DOUBLES REG 4. VALUE
             ST    R4,H2         STORE DOUBLED HEIGHT IN H2
             MR    R1,3          MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE CONTENTS IN REG 2.
             M     R1,H2         MUTIPLY CONTENTS OF REG 2. BY H1.    
             ST    R2,VOL2       STORE RESULT OF VOLUME(DOUBLED) IN VOL2.
    * DIFF. BETWEEN BOTH ------------------------
             L     R2,VOL1      LOAD VOL1 INTO REG. 2.
             S     R2,VOL2      SUBTRACT R2 FROM VOL2.
             ST    R2,DIF       STORE THE RESULT.
    * LABLES ------------------------
    L1       DC    F'2'         LENGTH - 2
    W1       DC    F'2'         WIDTH - 2
    H1       DC    F'2'         HEIGHT - 2
    DBL      DC    F'2'         CONSTANT TO DOUBLE ALL VALUES.
    VOL1     DS    F            STORES VOLUME 1. - NON DOUBLED.
    VOL2     DS    F            STORES VOLUME 2. - DOUBLED.
    L2       DS    F            DOUBLED LENGTH
    W2       DS    F            DOUBLED WIDTH
    H2       DS    F            DOUBLED HEIGHT
    DIF      DS    F            DIFF. BETWEEN VOL1 AND VOL2
    *
    *
So I thought that this was it because I understand the concept of everything here, but Z390 gives me this output:

Code
Enter command or help
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    *** 02/06/17 18:26:24 CMD task started
    C:\Program Files (x86)\Automated Software Tools\z390>CD \Program Files (x86)\Automated Software Tools\z390\
    C:\Program Files (x86)\Automated Software Tools\z390>ASMLG "C:\Users\Owner\Desktop\New folder\SHELL" TRACE CON
    C:\Program Files (x86)\Automated Software Tools\z390>rem asmlg assemble, link, and go from mlc to 390 execution
    C:\Program Files (x86)\Automated Software Tools\z390>echo off
    18:26:24 SHELL     MZ390 START USING z390 V1.5.06 ON J2SE 1.8.0_73 02/06/17
    AZ390E error  98         (1/3)3      USING BASE,12
    AZ390E error 198         (1/5)5            L     R2,L1         STORE L1 IN REG 2.
    AZ390E error 198         (1/6)6            L     R3,W1         STORE W1 IN REG 3.
    AZ390E error 198         (1/7)7            L     R4,H1         STORE H1 IN REG 4.
    AZ390E error 198         (1/8)8            MR    R1,3          MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE
    AZ390E error 198         (1/9)9            M     R1,H1         MUTIPLY CONTENTS OF REG 2. BY H1.
    AZ390E error 198       (1/10)10            ST    R2,VOL1       STORE RESULT OF VOLUME IN VOL1.
    AZ390E error 198       (1/12)12            L     R2,L1         STORE L1 IN REG 2.(UNCHANGED FROM BEFORE)
    AZ390E error 198       (1/13)13            M     R1,DBL        DOUBLES REG 2. VALUE
    AZ390E error 198       (1/14)14            ST    R2,L2         STORE DOUBLED LENGTH IN L2
    AZ390E error 198       (1/15)15            M     R2,DBL        DOUBLES REG 3. VALUE
    AZ390E error 198       (1/16)16            ST    R3,W2         STORE DOUBLED WIDTH IN W2
    AZ390E error 198       (1/17)17            M     R3,DBL        DOUBLES REG 4. VALUE
    AZ390E error 198       (1/18)18            ST    R4,H2         STORE DOUBLED HEIGHT IN H2
    AZ390E error 198       (1/19)19            MR    R1,3          MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE
    AZ390E error 198       (1/20)20            M     R1,H2         MUTIPLY CONTENTS OF REG 2. BY H1.
    AZ390E error 198       (1/21)21            ST    R2,VOL2       STORE RESULT OF VOLUME(DOUBLED) IN VOL2.
    AZ390E error 198       (1/23)23            L     R2,VOL1      LOAD VOL1 INTO REG. 2.
    AZ390E error 198       (1/24)24            S     R2,VOL2      SUBTRACT R2 FROM VOL2.
    AZ390E error 198       (1/25)25            ST    R2,DIF       STORE THE RESULT.
    18:26:25 SHELL     MZ390 ENDED   RC=12 SEC= 0 MEM(MB)= 38 IO=232
    Press any key to continue . . .
    C:\Program Files (x86)\Automated Software Tools\z390>exit
    *** 02/06/17 18:26:25 CMD task ended TOT SEC=1 TOT LOG IO=30

So pretty much I've been trying to figure out what I'm doing wrong for an hour, and I have no clue. I think I'm having such an issue because I've been a high level programmer all my life. So what the fuck am I doing wrong guys?
[Image: BQ6bF1l.png]
Can you link the emulator/how to compile it so I can test it out for you?
(Feb 6, 2017 05:38 PM)Annabelle Lee Wrote:  Can you link the emulator/how to compile it so I can test it out for you?

Sure I can:
Windows - Z390

You need to have Java installed to install Z390. After you do that, you can compile my code into a file called
Code
anythingyouwant.mlc

Once you did that I suggest putting that file into a folder, because Z390 will generate a bunch of shit. You can then open Z390 and do File > ASMLG and pick your anythingyouwant.mlc and run it. I recommend you do "Trace" option under the "Options" drop down. Thanks for your help!
[Image: BQ6bF1l.png]
If anyone ever needs it here's the solution (one way at least):
TITLE 'ASSIGNMENT ONE - AREA CALCULATION.'
ONE CSECT
Code
**********************************************************************
*    AUTHOR:         ROLEX
*    DESCRIPTION: DOES SUBTRACTION BETWEEN AN AREA AND THAT AREA DOUBLED.
*    STATUS:         WORKING 100%
**********************************************************************
*
R12         EQU   12            BASE REGISTER
R13      EQU   13            SAVE AREA POINTER
R14         EQU   14             RETURN REGISTER
* STANDARD ENTRY AND INITIALIZATION:
         STM   R14,R12,12(R13) SAVE REGISTERS
         BALR  R12,0        LOAD BASE REGISTER
         USING BASE,R12        DECLARE BASE ADDRESS AND REGISTER
BASE     ST    R13,SAVE+4   SAVE R13
         LA       R13,SAVE        R13 = ADDRESS OF SAVE AREA
* BEGIN
         L     3,L1         R3 = LENGTH OF BOX.
         L     5,W1         R5 = WIDTH OF BOX.
         L     7,H1         R7 = HEIGHT OF BOX.
         MR    2,5          HEIGHT OF BOX X WIDTH OF BOX.
         M     2,H1         RESULT OF MUTIPLY X HEIGHT OF BOX.    
         ST    3,VOL1       R2 = ALL HEIGHT X WIDTH X HEIGHT.  
         L     3,L1         R3 = LENGTH OF BOX.
         M     2,DBL        MUTIPLY LENGTH OF BOX BY 2.
         ST    3,L2         R3 = LENGTH OF BOX X 2.
         M     4,DBL        MUTIPLY WIDTH OF BOX BY 2.
         ST    5,W2         R5 = WIDTH OF BOX BY 2.
         M     6,DBL        MUTIPLY HEIGHT OF BOX BY 2
         ST    7,H2         R7 = HEIGHT OF BOX X 2
         MR    2,5          MUTIPLY LENGTH OF BOX (DOUBLED) BY WIDTH OF BOX(DOUBLED)
         M     2,H2         MUTIPLY RESULT BY HEIGHT OF BOX (DOUBLED)  
         ST    3,VOL2       R3 = LENGTH X WIDTH X HEIGHT    
         L     3,VOL2       R3 = VOLUME OF FIRST BOX.
         S     3,VOL1       SECOND VOLUME(DOUBLED) - FIRST VOLUME.
         ST    3,DIF        R3 = DIFF. BETWEEN VOLUMES.
* STANDARD EXIT:            
DONE     L     R13,SAVE+4   RESTORE R13
         LM    R14,R12,12(R13)  RESTORE REGISTERS
         BR    R14            RETURN
* STORAGE:
L1       DC    F'2'         LENGTH = 2
W1       DC    F'2'         WIDTH = 2
H1       DC    F'2'         HEIGHT = 2
DBL      DC    F'2'         CONSTANT VALUE = 2
VOL1     DS    F            STORAGE FOR FIRST VOLUME (NON-DOUBLED)
VOL2     DS    F            STORAGE FOR SECOND VOLUME (DOUBLED)
L2       DS    F            LENGTH(DOUBLED)
W2       DS    F            WIDTH(DOUBLED)
H2       DS    F            HEIGHT(DOUBLED)
DIF      DS    F            STORAGE FOR DIFFERNCE IN VOLUMES.
SAVE     DS    18F
         END   ONE
[Image: BQ6bF1l.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Assembly] by iTHXAug 13, 2022 05:14 PM 10 581 Aug 13, 2022 05:14 PM
Last Post: nulluser123
[Assembly] by ToyBoyAug 1, 2021 06:20 PM 0 180 Aug 1, 2021 06:20 PM
Last Post: ToyBoy
[Help] by superMatas2Dec 15, 2016 09:08 AM 2 284 Dec 15, 2016 09:08 AM
Last Post: superMatas2