PLEASE FOLLOW THE INSTRUCTION

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

PLEASE FOLLOW THE INSTRUCTION. AND IF YOU DON'T KNOW, DON'T WASTE TIME.

Expert Solution
Step 1

This is very simple.

Here is the complete ARM Code for the given problem statement.

---------------------------------------------------- ARM Code --------------------------------------------------

                    AREA MagicSquare, CODE, READONLY    
                    ENTRY   
                     
                    MOV r9, #0   
                    MOV r8, #1   
                    MOV r7, #0    
                    MUL r6, r1, r1 ; r6 = N^2   
                    ADD r6, r6, #1 ; r6 = N^2 + 1   
                    MUL r6, r6, r1 ; r6 = N(N^2 + 1)   
                    MOV r6, r6, LSR #1 ; r6 = N(N^2 + 1)/2    

                    BL Initialize   Rows0 
                    MOVEQ r3, #0 Rows  
                    LDRB r4, [r2], #1 ; r4 = element for row addition       

                    ADD r3, r3, r4 ; acc row sums to r3       
                    SUBS r5, r5, #1 ; decrement counter       
                    BNE Rows  Check_Rows   
                    SUBS r7, r7, #1 ; row counter   
                    BEQ Column_Init ; tested all rows successfully   
                    CMP r3, r6 ; test for magic   
                    MOVEQ r5, r1 ; reset counter   
                    BEQ Rows0 ; test next row   
                    B Done  Column_Init   

                    BL Initialize  Columns0   
                    MOVEQ r3, #0 Columns   
                    LDRB r4, [r2], r1   
                    ADD r3, r3, r4   
                    SUBS r5, r5, #1   
                    BNE Columns  Check_Columns   
                    SUBS r7, r7, #1   
                    BEQ Diag_Init   
                    CMP r3, r6   
                    MOVEQ r5, r1   
                    MOVEQ r2, #0x20000010   

                    ADDEQ r2, r2, r8   
                    ADDEQ r8, r8, #1   
                    BEQ Columns0   
                    B Done  Diag_Init   

                    BL Initialize  Diags0   
                    MOVEQ r3, #0   
                    ADD r10, r1, #1 
                    Diags   LDRB r4, [r2], r10  
                    ADD r3, r3, r4   
                    SUBS r5, r5, #1   
                    BNE Diags  Diags1   
                    CMP r3, r6   
                    BNE Done   
                    MOV r3, #0   
                    MOV r2, #0x20000010   
                    MOV r7, r1   
                    SUB r7, r7, #1   
                    ADD r2, r2, r7   
                    SUB r10, r1, #1   
                    MOV r5, r1 Diags2  
                    LDRB r4, [r2], r10   
                    ADD r3, r3, r4  
                    SUBS r5, r5, #1   
                    BNE Diags2      

                    CMP r3, r6   
                    MOVEQ r9, #0xFFFFFFFF  

                    Done B Done  

                    END

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education