Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Starting with the Count.j example, implement Butcher's Easter Algorithm to calculate and print the date of Easter for the next 10 years in JVM assembly

Starting with the Count.j example, implement Butcher's Easter Algorithm to calculate and print the date of Easter for the next 10 years in JVM assembly language.

I keep getting errors on line 67, 68, 70. I dont understand why!!! any help much appreciated

my code so far

.class public Easter .super java/lang/Object

; ; standard initializer .method public ()V aload_0 invokenonvirtual java/lang/Object/()V return .end method

.method public static main([Ljava/lang/String;)V ; set limits used by this method .limit locals 20 .limit stack 6

; setup local variables:

; 1 - the PrintStream object held in java.lang.System.out getstatic java/lang/System/out Ljava/io/PrintStream; astore_1

; 2 - the integer 10 - the counter used in the loop bipush 10 sipush 2017 istore_2 ;count is in 2 istore 4 ;year is in 4

; now loop 10 times printing out a number

Loop:

; compute 10 - ... iload 4 ;year bipush 19 irem istore 5 ; a is in 5 bipush 100 dup2 iinc 4 1 ;increment year idiv istore 6 ; b is in 6 irem istore 7 ; c is in 7 iload 6 bipush 4 dup2 idiv istore 8 ; d is in 8 irem istore 9 ; e is in 9 iload 6 bipush 8 iadd istore 10 ; f is in 10 iload 6 iload 10 isub bipush 1 iadd bipush 3 idiv istore 11 ;g is in 11 bipush 19 iload 5 imult iload 6 ;line 67 iadd iload 8 isub ; line 70 iload 11 isub bipush 15 iadd bipush 30 irem istore 12 ;h is in 12 iload 7 bipush 4 dup 2 idiv istore 13 ;i is in 13 irem istore 14 ;k is in 14 bipush 32 bipush 2 iadd iload 9 imult bipush 2 iadd iload 13 imult iload 12 isub iload 14 isub bipush 7 irem istore 15 ;x is in 15 iload 5 bipush 11 iadd iload 12 imult bipush 22 iadd iload 15 imult bipush 451 idiv istore 16 ; m is in 16 iload 12 iload 15 iadd bipush 7 isub iload 16 imult bipush 114 iadd bipush 31 idiv istore 17 ; easter month is in 17

invokestatic java/lang/String/valueOf(I)Ljava/lang/String; astore_3 ; ... and print it aload_1 ; push the PrintStream object aload_3 ; push the string we just created - then ... invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V

; decrement the counter and loop iinc 2 -1 iload_2 ifne Loop

; done return

.end method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago