Write and submit a MIPS Assembly Language program which requests an integer (year) from the user and then invokes a function to determine the beginning date and time of each season. The program must be properly documented which includes in file comments. Note: This is a Computer Science/Engineering course, not a Physics/Astronomy course. The exact time is not expected. Approximations are acceptable. Document your calculation process in the report. Basically, the intent is that you store a reference date and time for each Equinox and Solstice. Then, multiply the difference in years by 365 days, 5 hours, and 50 minutes to determine the date and time for the requested year. Suppose that you use 2015 as the reference year. Then it is known that spring began at 5:46 P.M. on March 20 (Julian Date 79). If you want to know when spring begins in 2018, then you would add 1095 days, 15 hours, and 150 minutes and subtract the number of days in 2015, 2016, and 2017 (365, 366, 365). 79(17:46)+1,095(17:30)-1096 = 78(35:16) = 79(11:16) That gives you 11:16 A.M. on March 20 in 2018 which matches the actual date and time.
; Source name : TIMETEST.ASM
; Executable name : TIMETEST
; nasm -f elf -g -F stabs timetest.asm
; gcc timetest.o -o timetest
;
[SECTION .data] ; Section containing initialised data
TimeMsg db “Hey, what time is it? It’s %s“,10,0
YrMsg db “The year is %d.“,10,0
Elapsed db “A total of %d seconds has elapsed since program began running.“,
10,0
[SECTION .bss] ; Section containing uninitialized data
OldTime resd 1 ; Reserve 3 integers (doubles) for time values
NewTime resd 1 ; 32-bit time_t value
TimeDiff resd 1 ; 32-bit time_t value
TimeStr resb 40 ; Reserve 40 bytes for time string
TmCopy resd 9 ; Reserve 9 integer fields for time struct tm
[SECTION .text] ; Section containing code
extern ctime
extern difftime
extern getchar
extern printf
extern localtime
extern strftime
extern time
global main ; Required so linker can find entry point
main:
push ebp ; Set up stack frame for debugger
mov ebp,esp
push ebx ; Program must preserve EBP, EBX, ESI, & EDI
push esi
push edi
;;; Everything before this is boilerplate; use it for all ordinary apps!
; Generate a time_t calendar time value with glibc’s time() function:
push 0 ; Push a 32-bit null pointer to stack,
; since we don’t need a buffer.
call time ; Returns calendar time in EAX
add esp,4 ; Clean up stack after call
mov [OldTime],eax ; Save time value in memory variable
; Generate a string summary of local time with glibc’s ctime() function:
push OldTime ; Push address of calendar time value
call ctime ; Returns pointer to ASCII time string in EAX
add esp,4 ; Stack cleanup for 1 parm
push eax ; Push pointer to ASCII time string on stack
push TimeMsg ; Push pointer to base message text string
call printf ; Merge and display the two strings
add esp,8 ; Stack cleanup: 2 parms X 4 bytes = 8
; Generate local time values into glibc’s static tm struct:
push dword OldTime ; Push address of calendar time value
call localtime ; Returns pointer to static time structure in
EAX
add esp,4 ; Stack cleanup for 1 parm
; Make a local copy of glibc’s static tm struct:
mov esi,eax ; Copy address of static tm from eax to ESI
mov edi,TmCopy ; Put the address of the local tm copy in EDI
mov ecx,9 ; A tm struct is 9 dwords in size under Linux
cld ; Clear DF so we move up-memory
rep movsd ; Copy static tm struct to local copy
; Display one of the fields in the tm structure:
mov edx,dword [TmCopy+20] ; Year field is 20 bytes offset into tm
add edx,1900 ; Year field is # of years since 1900
push edx ; Push value onto the stack
push YrMsg ; Push address of the base string
call printf ; Display string and year value with printf
add esp,8 ; Stack cleanup: 2 parms X 4 bytes = 8
; Wait a few seconds for user to press Enter so we have a time difference:
call getchar ; Wait for user to press Enter
; Calculating seconds passed since program began running:
push dword 0 ; Push null ptr; we’ll take value in EAX
call time ; Get current time value; return in EAX
add esp,4 ; Clean up the stack
mov [NewTime],eax ; Save new time value
sub eax,[OldTime] ; Calculate time difference value
mov [TimeDiff],eax ; Save time difference value
push dword [TimeDiff] ; Push difference in seconds onto the stack
push Elapsed ; Push addr. of elapsed time message string
call printf ; Display elapsed time
add esp,8 ; Stack cleanup for 1 parm
;;; Everything after this is boilerplate; use it for all ordinary apps!
pop edi ; Restore saved registers
pop esi
pop ebx
mov esp,ebp ; Destroy stack frame before returning
pop ebp
ret ; Return control to Linux
Write and submit a MIPS Assembly Language program which requests an integer (year) from the user...
SOLVE USING C!!! Project objective: Conditional statements, loops, reading from file, user defined functions. **Submit source code (LargeProg1.c) through Canvas One source code file(unformatted text) will be submitted Here is INCOMPLETE code to get started: LargeProg1.c The file name must match the assignment The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas The code must be submitted on time in order to receive credit (11:59PM on the due date) Late submissions will...
This year Evan graduated from college and took a job as a deliveryman in the city. Evan was paid a salary of $68,500 and he received $700 in hourly pay for part-time work over the weekends. Evan summarized his expenses below: Cost of moving his possessions to the city (125 miles away) Interest paid on accumulated student loans Cost of purchasing a delivery uniform Contribution to State University deliveryman program $1,200 2,840 1,440 1,320 Calculate Evan's AGI and taxable income...