Click to See Complete Forum and Search --> : Need help with SPARC program please!


GTmauf
March 24th, 2006, 01:06 AM
Ok, I just can't seem to figure this out, programming in assembly sure isn't easy, lol, but anyways here's the deal. I'm supposed write a program in assembly to accept as command line arguments three integer strings representing a date in the format of mm dd yy. The program is then supposed to print the date like this, say I put in 9 11 90 for the command line, it should output 11th. September, 1990. Here is what I have so far, can anyone please tell me if i'm on the right track and any mistakes I might have made. I'm also not sure on how to accept command line arguments in SPARC assembly.

! Dates of the year

!!!(Is this wrong for accepting command line arguments in SPARC?)
int main(int argc, char**argv)

.global main

main:
save %sp, -96, %sp

cmp %i0, 4
bl usage
nop
ld [%i1+4], %o1
call atoi
nop

!on return, %o0 contains
!month number
!...on to day number

ld [%i1+8], %o0
call atoi
nop

!..on to year number
ld [%i1+12], %o2
call atoi
nop

!!!(Does this go before or after main)?
!!!(It's supposed to be the external pointer array)
jan_m: .asciz "January"
feb_m: .asciz "February"
mar_m: .asciz "March"
apr_m: .asciz "April"
may_m: .asciz "May"
jun_m: .asciz "June"
jul_m: .asciz "July"
aug_m: .asciz "August"
sep_m: .asciz "September"
oct_m: .asciz "October"
nov_m: .asciz "November"
dec_m: .asciz "December"

.align 4
months_m: .word jan_m, feb_m, mar_m, apr_m, may_m, jun_m
.word jul_m, aug_m, sep_m, oct_m, nov_m, dec_m

Any help with this would be greatly appreciated, Thank you!