Use Butcher\'s algorithm to calculate Easter for the next ten years in x86 assem
ID: 3587118 • Letter: U
Question
Use Butcher's algorithm to calculate Easter for the next ten years in x86 assembly language. Here is some code to get you started:
TITLE MASM Template (main.asm)
; Description:
;
; Revision date:
INCLUDE Irvine32.inc
COMMA=2ch
.data
march BYTE "March ",0
april BYTE "April ",0
y DWORD 2017
a dWORD ?
b DWORD ?
cc DWORD ?
.code
main PROC
call Clrscr
mov ecx, 10
NEXT:
mov eax, y
call WriteDec
call crlf
inc eax
mov y, eax
dec ecx
jnz NEXT
mov edx,offset march
call WriteString
mov al, COMMA
call WriteChar
call CRLF
exit
main ENDP
END main
Explanation / Answer
INCLUDE Irvine32.inc
COMMA=2ch
.data
march BYTE "March ",0
april BYTE "April ",0
y DWORD 2017
a dWORD ?
b DWORD ?
cc DWORD ?
Algorithm has been written in the comments
.code// code
main PROC// main procedure of the program
call Clrscr// call the clear screen
mov ecx, 10// move 10 to ecx
NEXT:
mov eax, y// move y to eax
call WriteDec// call the write dec
call crlf// call the crif
inc eax// increment eax
mov y, eax// Move eax to y
dec ecx// decrement the ecx
jnz NEXT// Jump with no zero
mov edx,offset march// offset march moved to edx
call WriteString// call the write string
mov al, COMMA// command moved to al
call WriteChar// call the write char
call CRLF// call the CRLF
exit
main ENDP// End of the main method
END main// End of the program
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.